Ch. 15 - Inheritance, Polymorphism, and Virtual Functions

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is polymorphism

ability to take many forms

what is base class access specification

affects how the members of the base class are inherited by the derived class

What is inheritance?

allows a new class to be based on a existing class --> new class inherits all the member variables and functions

What is a abstract base class

cannot be instantiated but other classes are derived from it

how do constructors and destructors work in base and derived classes

constructor is called before the derived class's constructor. destructors called in reverse order --> derived class's destructor called first

What is overriding base class functions

dynamically bound. only virtual functions can be overriden

Private base class access specification

private members: inaccessible protected members: private public members: private

Protected base class access specification

private members: inaccessible protected members: protected public members: protected

public base class access specification

private members: inaccessible protected members: protected public members: public

what is redefining base class functions

statically bound

what is a pure virtual function

virtual member function of a base class that must be overridden. written like this: virtual void methodName() = 0;

What is multiple inheritance

when a derived class has 2 or more base classes

what are virtual destructors

when you write a class with a destructor and that class could potentially become a base class


Ensembles d'études connexes

Chapter 2: The Core Values of an Organization

View Set

MGT 427 Chapter 11 Sources of Capital

View Set

Chapter 15: Partnerships: Termination and Liquidation

View Set

Chapter 17 The Uterus and Vagina

View Set

Mental Health from Fitzgerald's 5th Ed

View Set

Mr. Wagner Earth Science (Why is The Earth Round?)

View Set

Texas Law of Agency - Chp. 2 Basic Agency Relationships, Disclosure and Duties to Clients

View Set