www.gibmonks.com

Main Page




Previous Page
Next Page

[Page 682 (continued)]

Self-Review Exercises

12.1

Fill in the blanks in each of the following statements:

  1. __________ is a form of software reuse in which new classes absorb the data and behaviors of existing classes and embellish these classes with new capabilities.

  2. A base class's __________ members can be accessed only in the base-class definition or in derived-class definitions.

  3. In a(n) __________ relationship, an object of a derived class also can be treated as an object of its base class.

  4. In a(n) __________ relationship, a class object has one or more objects of other classes as members.


  5. [Page 683]
  6. In single inheritance, a class exists in a(n) __________ relationship with its derived classes.

  7. A base class's __________ members are accessible within that base class and anywhere that the program has a handle to an object of that base class or to an object of one of its derived classes.

  8. A base class's protected access members have a level of protection between those of public and __________ access.

  9. C++ provides for __________, which allows a derived class to inherit from many base classes, even if these base classes are unrelated.

  10. When an object of a derived class is instantiated, the base class's __________ is called implicitly or explicitly to do any necessary initialization of the base-class data members in the derived-class object.

  11. When deriving a class from a base class with public inheritance, public members of the base class become __________ members of the derived class, and protected members of the base class become __________ members of the derived class.

  12. When deriving a class from a base class with protected inheritance, public members of the base class become __________ members of the derived class, and protected members of the base class become __________ members of the derived class.

12.2

State whether each of the following is true or false. If false, explain why.

  1. Base-class constructors are not inherited by derived classes.

  2. A has-a relationship is implemented via inheritance.

  3. A Car class has an is-a relationship with the SteeringWheel and Brakes classes.

  4. Inheritance encourages the reuse of proven high-quality software.

  5. When a derived-class object is destroyed, the destructors are called in the reverse order of the constructors.


Previous Page
Next Page