![]() |
| | #1 |
| Registered User Join Date: Apr 2009
Posts: 2
| question about classes Sorry nevermind I figure it out. So sorry. Last edited by naroken; 04-29-2009 at 10:35 AM. Reason: figure it out |
| naroken is offline | |
| | #2 |
| Registered User Join Date: Apr 2009
Posts: 2
| I dont know how to delete it after i posted it too. anyone know how to? |
| naroken is offline | |
| | #3 |
| Registered User Join Date: Jan 2002 Location: Northern Virginia/Washington DC Metropolitan Area
Posts: 2,787
| 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).
__________________ On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. --Charles Babbage, 1792-1871 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 |
| hk_mp5kpdw is offline | |
| | #4 |
| Registered User Join Date: Jan 2002 Location: Northern Virginia/Washington DC Metropolitan Area
Posts: 2,787
| Click on the "edit" button in the post you wish to delete. From there you'll have options to delete a post.
__________________ On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. --Charles Babbage, 1792-1871 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 |
| hk_mp5kpdw is offline | |
![]() |
| Tags |
| class, classes, error c2065 |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Classes question... | Raigne | C++ Programming | 24 | 09-12-2006 01:46 AM |
| Simple question about classes (destructor and operator overloading) | Loctan | C++ Programming | 2 | 07-28-2006 02:59 PM |
| Simple Question about Classes | Loctan | C++ Programming | 5 | 06-26-2006 02:40 AM |
| Classes and Win32 API, and another Question | philvaira | Windows Programming | 10 | 04-10-2004 07:21 PM |
| Newbie question about the Private type in classes | Ryeguy457 | C++ Programming | 1 | 09-07-2002 10:17 PM |