Question: A. Design a UML diagram for the Inheritance relation between ZooAnimal and Large Animal B. Make the necessary changes below so that all calls to
| A. Design a UML diagram for the Inheritance relation between ZooAnimal and Large Animal B. Make the necessary changes below so that all calls to the ZooAnimal member function reptName are passed to the matching function in the derived type when called for an object of the derived type. C. Write a polymorphic function reptName in the child class to return the species D. Write a main function to test the new polymorphic function reptName E. Trasnfer the ZooAnimal class to an abstract class and the polymorphic functions to virtual class ZooAnimal { private: char* name; int cageNumber; int weightDate; int weight; public: |
| ZooAnimal (char*, int, int, int); // constructor function inline ~ZooAnimal () { delete [] name; }; // destructor function void changeWeight (int pounds); char* reptName (); int reptWeight (); int daysSinceLastWeighed (int today); }; char* ZooAnimal::reptName () { return name; } class LargeAnimal : public ZooAnimal { private: char* species; float cageMinimumVolume; public: LargeAnimal (char*, int, int, int, char*, float); // constructor function inline ~LargeAnimal () { delete [] species; }; // destructor function float reptCageMinimumVolume (); char* reptName (); }; |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
