Self-Review Exercises

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

    1. Treating a base-class object as a(n)                 can cause errors.

    2. Polymorphism helps eliminate                 logic.

    3. If a class contains at least one pure virtual function, it’s a(n)                 class.

    4. Classes from which objects can be instantiated are called                 classes.

    5. Operator                 can be used to downcast base-class pointers safely.

    6. Operator typeid returns a reference to a(n)                 object.

    7.                 involves using a base-class pointer or reference to invoke virtual functions on base-class and derived-class objects.

    8. Overridable functions are declared using keyword                .

    9. Casting a base-class pointer to a derived-class pointer is called                .

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

    1. All virtual functions in an abstract base class must be declared as pure virtual functions.

    2. Referring to a derived-class object with a base-class handle is dangerous.

    3. A class is made abstract by declaring that class virtual.

    4. If a base class declares a pure virtual function, a derived class must implement that function to become a concrete class.

    5. Polymorphic programming can eliminate the need for switch logic.

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

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