Define classes that satisfy the following conditions and the hierarchy in the
diagram below.
A definition of an object, for a class in the bottom of the hierarchy, should
produce a message consisting of the names of all the classes that directly
or indirectly are related to the object.
A definition of an object, for a class not in the bottom of the hierarchy,
should prompt the compiler to issue an error message.
Each defined object should be able to respond to the following methods.
talk—A parameter-free function that produces a message from the
object.
xivore—A parameter-free function that produces the message
‘carnivore’ or ‘herbivore’ that reflects on the kind of object in
discourse.
Each of the classes is allowed to explicitly declare at most two member
functions, with at most one of the two not being a constructor.
The body of each member function should be a single command of the form
‘cout << "...";’.
A string containing the name of a class may appear only within members of the
class. (That is, if A is a name of a class and x is a string ”...A...” referring to A,
then x may be included only within members of A.)