Main Page

Previous Page
Next Page

[Page 746 (continued)]

Self-Review Exercises


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 is 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 _________ .


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.

Previous Page
Next Page