So GetAge has to return a value ? i tried doing it compiler with no error's or warning's but the horses age is always 1 no matter what.
Code:#include <iostream> using namespace std; class Animal { public: void SetAge(int age) { Age = age; } int GetAge() const { cout <<Age; return 0; } private: int Age; }; int main() { Animal * Horse = new Animal; Horse->SetAge(19); cout <<"The horses age is "<<Horse->GetAge<<endl; cin.get(); return 0; }