Hey this is an awesome forum, now I am having a problem with a class i am building. I get error C2065 which is the undeclared identifier. My header look like this :
Sorry nevermind I figure it out. So sorry.
This is a discussion on question about classes within the C++ Programming forums, part of the General Programming Boards category; Hey this is an awesome forum, now I am having a problem with a class i am building. I get ...
Hey this is an awesome forum, now I am having a problem with a class i am building. I get error C2065 which is the undeclared identifier. My header look like this :
Sorry nevermind I figure it out. So sorry.
Last edited by naroken; 04-29-2009 at 10:35 AM. Reason: figure it out
I dont know how to delete it after i posted it too. anyone know how to?
Those function names need Food:: in front of them.Code:void setName(string a) { name = a; } string getName(void) { return name; } void setCalories(int b) { calories = b; } int getCalories(void) { return calories; } void setFat(int c) { fatCal = c*9; } int getFat(void) { return fatCal; } void setTotalCal(int d, int e) { d = fatCal; e = calories; totalCal = d + e; } int getTotalCal(void) { return totalCal; }
Also, the getter functions should be declared const and you should avoid putting a using namespace directive in a header file (explicitly qualify any std namespace objects as necessary).
I used to be an adventurer like you... then I took an arrow to the knee.