CS233V C++ Programming

Assignment #10

Exercises

10.1, 10.4, 10.6, 10.8

Programming

  1. Implement an abstract base class Animals with pure virtual functions char * Sound(),char * Food(), char * Habitat() and print(). Give the class any private data you can think of that would be common to all animals.
  2. Implement several classes derived from Animal, such as Dog, Cow, and Tiger. They should provide the appropriate char * Sound(),char * Food(),char * Habitat() and print() functions, as well as any other appropriate private data. Use your imagination.
  3. In a driver program, create an array of Animal pointers, and load it with pointers to several (10-15) animals of various types. Then write a loop that steps through this array and demonstrates the Sound(), Food(), Habitat() and print() functions.