#include <iostream.h>
class Cat
{
public:
Cat() {itsAge = 2;}
~Cat() {};
GetAge() {return itsAge;}
void SetAge(int age) {itsAge = age;}
private:
int itsAge;
};
int main()
{
Cat *p = new Cat;
cout << p->GetAge() << endl;
p->SetAge(10);
cout << p->GetAge();
return 0;
}
<< moderator edit: added [code][/code] tags >>
When we are declaring "Cat *p", is Cat a constructor or a type?
When we are declaring "new Cat", is Cat a constructor or a type?