Inheritance Terminology Reference

This reference provides an overview of inheritance terminology you'll encounter in this chapter. Use it as a quick lookup guide.

Inheritance Basics

Term Definition Example
Base Class Class being inherited from, parent class class Animal { };
Derived Class Class inheriting from base, child class class Dog : public Animal { };
Superclass Another term for base class Parent in hierarchy
Subclass Another term for derived class Child in hierarchy
Is-a Relationship Derived object is a type of base object Dog is-an Animal
Class Hierarchy Tree structure of inheritance relationships Animal → Mammal → Dog

Access Specifiers

Term Definition Example
public Inheritance Public/protected members keep access level class Dog : public Animal
protected Inheritance Public members become protected class Dog : protected Animal
private Inheritance Public/protected members become private class Dog : private Animal
public Member Accessible from anywhere public: void bark();
protected Member Accessible in class and derived classes protected: int m_age;
private Member Only accessible within defining class private: int m_secretID;

Member Inheritance

Term Definition Example
Inherited Member Member from base class available in derived Derived inherits base methods
Hidden Member Derived member shadows base member with same name void foo() in both base and derived
Override Derived class provides new implementation of virtual function void draw() override;
Overload Multiple functions with same name, different parameters void print() and void print(int)
Name Hiding Derived member hides all base members with same name Even with different signatures
Using Declaration Bringing hidden base member into derived scope using Base::print;

Construction and Destruction

Term Definition Example
Constructor Chaining Derived constructor calls base constructor : Base{args} in initializer list
Initialization Order Base constructed before derived Base members, then derived members
Destruction Order Derived destroyed before base Reverse of construction
Default Base Constructor Base default constructor called automatically If not explicitly called
Explicit Base Construction Explicitly calling base constructor Dog() : Animal{name} { }

Virtual Functions

Term Definition Example
Virtual Function Function that can be overridden in derived classes virtual void speak();
Pure Virtual Function Virtual function with no implementation, must be overridden virtual void speak() = 0;
Abstract Class Class with at least one pure virtual function Cannot be instantiated
Concrete Class Class with no pure virtual functions Can be instantiated
Override Specifier Explicitly marks function as override void speak() override;
Final Specifier Prevents further overriding void speak() final;

Polymorphism Support

Term Definition Example
Dynamic Binding Function call resolved at runtime Virtual function call through pointer/reference
Static Binding Function call resolved at compile time Non-virtual function call
Virtual Table Table of function pointers for virtual functions vtable, one per class with virtuals
Virtual Pointer Pointer to vtable in each object vptr, hidden member
Object Slicing Derived object copied to base, loses derived parts Base b = derivedObj;
Upcasting Converting derived pointer/reference to base Animal* ptr = &dog; (safe)
Downcasting Converting base pointer/reference to derived Dog* ptr = dynamic_cast<Dog*>(animalPtr);

Multiple Inheritance

Term Definition Example
Multiple Inheritance Deriving from more than one base class class Bat : public Mammal, public FlyingAnimal
Diamond Problem Same base inherited through multiple paths A → B,C → D (A inherited twice)
Virtual Inheritance Sharing single base instance in diamond class B : virtual public A
Ambiguity Multiple inherited members with same name Must qualify: Base1::func() vs Base2::func()
Resolution Operator Specifying which base member to use obj.Base1::member

Design Principles

Term Definition Example
Liskov Substitution Derived object usable wherever base expected Fundamental OOP principle
Interface Inheritance Inheriting interface (pure virtual functions) Abstract base defining contract
Implementation Inheritance Inheriting both interface and implementation Concrete base with implementations
Composition over Inheritance Prefer has-a over is-a when appropriate More flexible design
Fragile Base Class Changes to base break derived classes Careful with non-virtual public methods
Protected Interface Members accessible to derived classes only protected section

Special Cases

Term Definition Example
Final Class Class that cannot be inherited from class Dog final : public Animal
Empty Base Optimization Empty base takes no space Compiler optimization
Private Inheritance Implementation Using private inheritance for implementation reuse Not is-a relationship
Mixin Class Class providing specific functionality through inheritance Template base classes
CRTP Curiously Recurring Template Pattern class Derived : public Base<Derived>