Just a small correction so nramsbottom doesn''t get confused when looking at this wonderfull dog class =) and wondering where m_nAge came from. You forgot to declare the member variable m_nAge, so the class should read:
class Dog
{
public:
Dog(int age = 0){m_nAge = age;}
int GetAge(void){return m_nAge;}
void SetAge(int age){m_nAge = age;}
void Bark(void){cout << "Ruff ruff.\n";}
private:
m_nAge; // Made this private since you provided accesor
};
Help me! - Classes, pointers and arrays
I think that the entire text of Sams Teach Yourself C++ in 21 Days, Second Edition is available online at informit.com and I just found out that the free book at about.com is Sams Teach Yourself C++ in 21 Days, Third Edition.
-TMOLI 42
-TMOLI 42
- TMOLI 42 Powered by hypocrisy!"Go crazy? Don't mind if I do!" - Homer Simpson
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement