Question: #include #include using namespace std; /* Create a Zoo. Randomly fill it with: 1-) Lion 2-) Bird 3-) Fish Include the following attributes for each

#include #include using namespace std; /* Create a Zoo. Randomly fill it with: 1-) Lion 2-) Bird 3-) Fish

Include the following attributes for each animal: Lion: Food type it lines Bird: Number of Eggs it lays every week Fish: How fast they swim

Then, display the Zoo statistics, counting how many of each animal we have.

Zoo size Max: 30 */

class Animal { public: virtual string gettype() = 0; };

class Lion : public Animal { public: string gettype() { return "Lion"; } };

class Fish : public Animal { public: string gettype() { return "Fish"; } };

class Bird: public Animal { public: string gettype() { return "Bird"; } };

void main() { Animal *Zoo[30];

Zoo[0] = new Lion(); Zoo[1] = new Bird(); Zoo[2] = new Fish();

for (int i = 0; i < 3; i++) cout << Zoo[i] << " " << Zoo[i]->gettype() << endl;

}

please c++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!