#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?

Cat *p----- declares a pointer of class Cat

and when u do ----new cat -------then your are trying to allocate memory for that pointer. new operator automatically calls the constructor of the class