CPlusOOP
SiteMap
Reusable Software
Structured Programming
Inheritance/Polymorphism
«Prev
Reusable Code
Polymorphism Concept
Comparing Conversion Operators
ADT Conversion
Conversion Member Functions
Signature Matching Algorithm
Operator Overloading
Unary Binary Overloading
friend Function Usage
friend Function - Quiz
Overloading Operators
Pure Polymorphism
Define Class Inheritance
Pure Polymorphism
Derived Class
Public Inheritance
public Inheritance - Quiz
Constructors Base
Reference Typing Conversions
print member-function
Virtual Functions
Guidelines Virtual Functions
Virtual Function - Selection
Virtual Function - Exercise
Abstract Classes
Reinterpret const cast
Dynamic cast Operator
RTTI
typeid Operator
throw C++ Exception
Pure Polymorphism Conclusion
Ecological Simulation
Virtual functions and Abstract Classes
Each question is worth one point. Select the best answer or answers for each question.
1.
To dynamically select at runtime the appropriate member function from among base and derived class functions, use:
A.
keyword virtual on the base class function
B.
keyword virtual in the class name declaration to specify all functions virtual
C.
keywords pure virtual on all virtual functions in the base class
D.
void* pointer to automatically select among functions
2.
In dynamic virtual function selection, the function selected depends on:
A.
the object being pointed at
B.
the pointer type
C.
the return type
D.
none of these
3.
____________ can be virtual.
A.
Any function
B.
Any nonstatic function
C.
Any nonstatic, nonconstructor function
D.
Any nonstatic, nonconstructor, nondestructor function
4.
An abstract base class:
A.
consists entirely of pure virtual functions
B.
has no functions, only data members
C.
has at least one pure virtual function
D.
cannot be used in multiple inheritance
5.
A pure virtual function:
A.
is declared with = 0; in the base class
B.
has an empty body in the derived class and always uses base class code
C.
has the special null keyword in the body in the base class
D.
cannot appear in an abstract base class
6.
An abstract base class:
A.
can be used to declare pointers that can access subtype objects
B.
can be used to declare objects
C.
cannot have any functions containing code
D.
can have only functions that use the virtual keyword
Correct answers:
Your Score: 0
Submit
Quiz Explanation