Quiz 12 In order to use a dynamic_cast<> in a C++ program, runtime type informat
ID: 3697978 • Letter: Q
Question
Quiz 12
In order to use a dynamic_cast<> in a C++ program, runtime type information must be enabled.
true
false
---------------
In C++, a call to a virtual method though a base class pointer to a derived class object will use
dynamic binding / dynamic linkage.
automatic binding / static linkage.
static binding / static linkage.
external binding / external linkage.
------------------------
With public inheritance, the protected members of a base class can be accessed by
methods of that base class.
friends of that base class.
methods of any classes derived from that base class.
All of the above.
----------------------
What is the C++ syntax for declaring the class Dog to be a derived class of the base class Pet?
class Pet : public Dog
class Dog : public Pet
class Dog public subclass of Pet
class Dog derived from public Pet
-------------------
When a derived class object is destroyed, in what order are the destructors executed?
First the derived class destructor is executed, then the base class destructor is executed.
First the base class destructor is executed, then the derived lass destructor is executed.
Only the base class destructor is executed.
Only the derived class destructor is executed.
---------------------------------------
In C++, what is a pure virtual method?
In C++, what is an abstract class?
Assume that Pet is a base class, and Cat is a class derived from Pet using public inheritance. What is the correct way to call the print() method of the Pet class from the print() method of the Cat class?
Cat::print();
super.print();
Pet::print();
base.print();
--------------------------------
When a derived class object is created, in what order are the constructor bodies executed?
First the derived class constructor body is executed, then the base class constructor body is executed.
First the base class constructor body is executed, then the derived class constructor body is executed.
Only the base class constructor body is executed.
Only the derived class constructor body is executed.
-------------------------------------
A base class pointer that points to a derived class object can be used to call
only methods declared in the derived class.
only methods declared in the base class.
any method declared in either the base class or the derived class.
any method in any class included in your program.
Explanation / Answer
In order to use a dynamic_cast<> in a C++ program, runtime type information must be enabled. True
In C++, a call to a virtual method through a base class pointer to a derived class object will use dynamic binding / dynamic linkage.
With public inheritance, the protected members of a base class can be accessed by methods of that base class. All of the above.
What is the C++ syntax for declaring the class Dog to be a derived class of the base class Pet? class Dog : public Pet
When a derived class object is destroyed, in what order are the destructors executed? First the derived class destructor is executed, then the base class destructor is executed.
In C++, what is a pure virtual method?
In C++, what is an abstract class?
Assume that Pet is a base class, and Cat is a class derived from Pet using public inheritance. What is the correct way to call the print() method of the Pet class from the print() method of the Cat class? super.print();
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.