] > Assignment 5: Inheritance (Due: Th, May 22)

Assignment 5: Inheritance (Due: Th, May 22)

Define classes that satisfy the following conditions and the hierarchy in the diagram below.

Example. The program

#include <iostream.h> 
// missing definitions 
int main(){ 
  leopard a; 
  a.talk(); 
  a.xivore(); 
  return 0; 
}

should produce an output of the following form.

animals carnivore cats leopard 
leoooo 
carnivore

---------| -------| --------|
-herbivore--animals- carnivore-
  |------------------------|||
--|-|    -------        -----||
cow-     -cats-  ---     -bears-||
        |------|   --- |-------||
      cat- -leopard| -panda| -polar|
           -------| ------| ------

Submit your source file ‘animals.cpp’ with the ‘submit c230aa lab5 animals.cpp’ command.

NOTE: In reality, pandas are not bears. But for this assignment we’ll assume they are.