I was going through the basics of C++ to make sure i got everything and i came accros this problem ive been trying for hours to fix this but the error just wont got away.
Code:#include <iostream> using namespace std; class Animal { public: void SetAge(int age) { Age = age; } int GetAge() const { cout <<Age; } private: int Age; }; int main() { Animal * Horse = new Animal; Horse->SetAge(19); cout <<"The horses age is "<<Horse->GetAge<<endl; cin.get(); return 0; }Code:Compiling... void.cpp C:\C++\RP\void.cpp(18) : warning C4761: integral size mismatch in argument; conversion supplied C:\C++\RP\void.cpp(8) : error C4716: 'Animal::GetAge' : must return a value Error executing cl.exe. RP.exe - 1 error(s), 1 warning(s)



LinkBack URL
About LinkBacks


