Questions and CORRECT Answers
Under public inheritance, derived-class objects can be treated as base class objects - CORRECT
ANSWER - true
A base-class initializer can be provided in the derived-class constructor to call the base-class
constructor explicitly; otherwise, the derived class' constructor will call the base class's
______________ constructor. - CORRECT ANSWER - default
A derived class can ______________________ a base-classes member functions by supplying a
new version of that function with the same signature - CORRECT ANSWER - override
A derived class can directly access protected members of its base class - CORRECT
ANSWER - true
Only members and friends of a base class, and members and friends of a derived class may
access a base class's ____________________ members. - CORRECT ANSWER -
protected
An "Is a" relationship is represented by - CORRECT ANSWER - inheritance
a "has a" relationship is represented by - CORRECT ANSWER - composition
A ____________________ class is more specific than its ____________________ class and
represents a smaller group of objects - CORRECT ANSWER - derived
base
When you use _____________________ inheritance all of the public and protected members in
the base class become protected in the derived class - CORRECT ANSWER - protected
, The process used to resolve which virtual function to call at run-time is called
________________ binding. - CORRECT ANSWER - dynamic
Apply C++ 11's ________________ keyword to every overridden function in a derived-class.
This causes the compiler to check whether the base class has a member function with the same
name and parameter list. - CORRECT ANSWER - override
When a virtual function is called using an object by name and using the dot member-selector,
what type of binding is used? - CORRECT ANSWER - static
C++ enables __________________________. This enables us to write programs that process
objects of classes that are part of the same class hierarchy as if they were all objects of the
hierarchy's base class. This allows us to "program in general" rather than "program in specific". -
CORRECT ANSWER - polymorphism
When calling a virtual function the program will choose the correct implementation according to
which of the following: - CORRECT ANSWER - Object Type
Once a function is declared ___________________ , it remains so all the way down the
inheritance hierarchy from that point even if it is not declared as such when a class overrides it. -
CORRECT ANSWER - virtual
A ________ ____________ function is one with an initializer of = 0 and has been declared
virtual. (2 words are expected) - CORRECT ANSWER - pure virtual
Provide a virtual base-class _______________________, even if one is not required. Then when
an object in the hierarchy is destroyed explicitly by applying the delete operator to a base-class
pointer to a derived class object, the entire object will be freed correctly. - CORRECT
ANSWER - destructor
When C++ compiles a class that has one or more virtual functions, it builds a
______________________________ for that class. This is used by the executing program to