Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Self-Review Exercises

23.1Fill 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. In single inheritance, a class exists in a(n) __________ relationship with its derived classes.

  6. 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.

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

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

  9. 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.

  10. 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.

  11. 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.

23.2State 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.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint