Inheritance and Polymorphism

Ace your homework & exams now with Quizwiz!

A Car class has an is-a relationship with the SteeringWheel and Brakes classes.

False

A class is made abstract by declaring that class virtual

False

A has-a relationship is implemented via inheritance.

False

All virtual functions in an abstract base class must be declared as pure virtual functions

False

Referring to a derived-class object with a base-class handle is dangerous.

False

_________ involves using a base-class pointer or reference to invoke virtual functions on base-class and derived-class objects.

Polymorphism

Base-class constructors are not inherited by derived classes.

True

If a base class declares a pure virtual function, a derived class must implement that function to become a concrete class.

True

Inheritance encourages the reuse of proven high-quality software.

True

Polymorphic programming can eliminate the need for switch logic

True

When a derived-class object is destroyed, the destructors are called in the reverse order of the constructors.

True

If a class contains at least one pure virtual function, it is a(n) __________ class.

abstract

C++ provides for __________, which allows a derived class to inherit from many base classes, even if these base classes are unrelated.

multiple inheritance.

Classes from which objects can be instantiated are called ________ classes

concrete

When an object of a derived class is instantiated, the base class's __________ is called implicitly or explicitly to do any necessary initialization of the base-class data members in the derived-class object.

constructor

Treating a base-class object as a(n) ________ can cause errors.

derived-class object.

Casting a base-class pointer to a derived-class pointer is called _________

down casting

Operator _________ can be used to downcast base-class pointers safely.

dynamic_cast

In single inheritance, a class exists in a(n) __________ relationship with its derived classes.

hierarchical

A base class's protected access members have a level of protection between those of public and __________ access

private

When deriving a class from a base class with protected inheritance, public members of the base class become __________ members of the derived class, and protected members of the base class become __________ members of the derived class.

protected, protected.

A base class's __________ members are accessible within that base class and anywhere that the program has a handle to an object of that base class or to an object of one of its derived classes

public

When deriving a class from a base class with public inheritance, public members of the base class become __________ members of the derived class, and protected members of the base class become __________ members of the derived class.

public, protected

Polymorphism helps eliminate _________ logic

switch

Operator typeid returns a reference to a(n) _________ object.

type_info

Overridable functions are declared using keyword _________ .

virtual


Related study sets

Health Assessment #4: HEENT & GI

View Set

►Restorative Art / ►Color Theory Examination

View Set

Биохимический анализ крови

View Set

Lewis Med-Surg Ch. 14 Infection and HIV

View Set

Microeconomics Final Exam Written Portion

View Set

1.2 Indicators to type of attack

View Set

Foreshadowing in "The Monkey's Paw"

View Set