Self-Review Exercises

  1. 11.1 Fill in the blanks in each of the following statements:

    1.               enables new classes to absorb the data and behaviors of existing classes and embellish these classes with new capabilities.

    2. A base class’s               and               members can be accessed in the base-class definition, in derived-class definitions and in friends of the base class and derived classes.

    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 class or 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 the 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 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 from a 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.

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

    1. Base-class constructors are not automatically 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. When a derived-class object is destroyed, the destructors are called in the reverse order of the constructors.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset