Defined Terms
abstract base class Class that has one or more pure virtual functions. We cannot create objects of an abstract base-class type.
accessible Base class member that can be used through a derived object. Accessibility depends on the access specifier used in derivation list of the derived class and the access level of the member in the base class. For example, a
public
member of a class that is inherited viapublic
inheritance is accessible to users of the derived class. Apublic
base class member is inacceessible if the inheritance isprivate
.base class Class from which other classes inherit. The members of the base class become members of the derived class.
class derivation list List of base classes, each of which may have an optional access level, from which a derived class inherits. If no access specifier is provided, the inheritance is
public
if the derived class is defined with thestruct
keyword, and isprivate
if the class is defined with theclass
keyword.derived class Class that inherits from another class. A derived class can override the virtuals of its base and can define new members. A derived-class scope is nested in the scope of its base class(es); members of the derived class can use members of the base class directly.
derived-to-base conversion Implicit conversion of a derived object to a reference to a base class, or of a pointer to a derived object to a pointer to the base type.
direct base class Base class from which a derived class inherits directly. Direct base classes are specified in the derivation list of the derived class. A direct base class may itself be a derived class.
dynamic binding Delaying until run time the selection of which function to run. In C++, dynamic binding refers to the runtime choice of which virtual function to run based on the underlying type of the object to which a reference or pointer is bound.
dynamic type Type of an object at run time. The dynamic type of an object to which a reference refers or to which a pointer points may differ from the static type of the reference or pointer. A pointer or reference to a base-class type can refer to an to object of derived type. In such cases the static type is reference (or pointer) to base, but the dynamic type is reference (or pointer) to derived.
indirect base class Base class that does not appear in the derivation list of a derived class. A class from which the direct base class inherits, directly or indirectly, is an indirect base class to the derived class.
inheritance Programming technique for defining a new class (known as a derived class) in terms of an existing class (known as the base class). The derived class inherits the members of the base class.
object-oriented programming Method of writing programs using data abstraction, inheritance, and dynamic binding.
override Virtual function defined in a derived class that has the same parameter list as a virtual in a base class overrides the base-class definition.
polymorphism As used in object-oriented programming, refers to the ability to obtain type-specific behavior based on the dynamic type of a reference or pointer.
private inheritance In
private
inheritance, thepublic
andprotected
members of the base class areprivate
members of the derived.protected access specifier Members defined after the
protected
keyword may be accessed by the members and friends of a derived class. However, these members are only accessible through derived objects.protected
members are not accessible to ordinary users of the class.protected inheritance In
protected
inheritance, theprotected
andpublic
members of the base class areprotected
members of the derived class.public inheritance The
public
interface of the base class is part of thepublic
interface of the derived class.pure virtual Virtual function declared in the class header using
= 0
just before the semicolon. A pure virtual function need not be (but may be) defined. Classes with pure virtuals are abstract classes. If a derived class does not define its own version of an inherited pure virtual, then the derived class is abstract as well.refactoring Redesigning programs to collect related parts into a single abstraction, replacing the original code with uses of the new abstraction. Typically, classes are refactored to move data or function members to the highest common point in the hierarchy to avoid code duplication.
run-time binding See dynamic binding.
sliced down What happens when an object of derived type is used to initialize or assign an object of the base type. The derived portion of the object is “sliced down,” leaving only the base portion, which is assigned to the base.
static type Type with which a variable is defined or that an expression yields. Static type is known at compile time.
virtual function Member function that defines type-specific behavior. Calls to a virtual made through a reference or pointer are resolved at run time, based on the type of the object to which the reference or pointer is bound.