12.1 Fill in the blanks in each of the following statements:
Treating a base-class object as a(n) can cause errors.
Polymorphism helps eliminate logic.
If a class contains at least one pure virtual
function, it’s a(n) class.
Classes from which objects can be instantiated are called classes.
Operator can be used to downcast base-class pointers safely.
Operator typeid
returns a reference to a(n) object.
involves using a base-class pointer or reference to invoke virtual
functions on base-class and derived-class objects.
Overridable functions are declared using keyword .
Casting a base-class pointer to a derived-class pointer is called .
12.2 State whether each of the following is true or false. If false, explain why.
All virtual
functions in an abstract base class must be declared as pure virtual
functions.
Referring to a derived-class object with a base-class handle is dangerous.
A class is made abstract by declaring that class virtual
.
If a base class declares a pure virtual
function, a derived class must implement that function to become a concrete class.
Polymorphic programming can eliminate the need for switch
logic.