Module 3. Constructors and Destructors Exercise Answers

1.
   // ---------- the constructor function
   ZooAnimal::ZooAnimal (char* who, int whichCage, int weighDay, int pounds)
   {
    char *name = new char[20];
    strcpy (name, who);
    cageNumber = whichCage;
    weightDate = weighDay;
    weight = pounds;
   }


2.
   ZooAnimal::ZooAnimal (char* who = "Nameless", int whichCage = 9999, 
                         int weighDay = 101, int pounds = 100)


3.
   // -------- member conversion function
   ZooAnimal::operator int ()
   {
    return cageNumber;
   }