i have a basic problem, why when i use this class, i cant get it to use the class function, getage()?
Code:
#include <iostream>
#include <conio.h>
using namespace std;
class dog
{
public:
dog(int iage);
~dog();
void bark();
int getage();
void setage(int age);
private:
int dogage;
};
dog::dog(int iage)
{
dogage= iage;
}
dog::~dog()
{
}
void dog::bark()
{
cout << "\n woof";
}
int dog::getage()
{
return dogage;
}
void dog::setage(int age)
{
dogage=age;
}
int main(){
dog anakin(5);
anakin.bark();
anakin.getage();
getch();
}