Inheritance is a mechanism in OOP to design two or more entities that are different but share many common features.
Features common to all classes are defined in the superclass.
The classes that inherit common features from the superclass are called subclasses.
We also call the superclass an ancestor and the subclass a descendant.
A Sample Inheritance
Here are the superclass Account and its subclasses Savings and Checking.
An example of inheritance hierarchy among different types of students.