Loading...
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
Inheritance allows a class (Derived Class) to acquire the properties and methods of another class (Base Class). It implements the "is-a" relationship.
class Animal { /* Base Class */ };
class Dog : public Animal {
/* Derived Class inheriting from Animal */
};The existing class being inherited from (also called Parent or Super class).
The new class that inherits features (also called Child or Sub class).
Members marked protected are private to the outside world but accessible to all derived classes. This is key for building class hierarchies.