Answers to Self-Review Exercises

  1. 12.1

    1. derived-class object.

    2. switch.

    3. abstract.

    4. concrete.

    5. dynamic_cast.

    6. type_info.

    7. Polymorphism.

    8. virtual.

    9. downcasting.

  2. 12.2

    1. False. An abstract base class can include virtual functions with implementations.

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

    3. False. Classes are never declared virtual. Rather, a class is made abstract by including at least one pure virtual function in the class.

    4. True.

    5. True.

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.