Lab 7
Inheritance is used to to implement an is a type of object
relationship. In this lab, you have the
following inheritance hierarchy. The base class is called Pet
and the derived classes are called Dog and Cat
The classes Dog and Cat inherit data members and methods from the Pet class
and may add their own instance varaiables or methods.
Thus, Dog and Cat are more specialized versions of Pet.
The Pet class has private data members for storing the pet's
name and age. The Dog and Cat classes have no additional
data members.
We would also be taking a look at how polymorphism adds a capability to a method to do different things based on the object t is acting upon.