Inheritance

Inheritance is an approach of sharing common functionality within a collection of classes. It provides an ability to avoid code duplication in a class that needs the same data and functions which another class already has. At the same time, it allows us to override or extend functionality that should have a different behavior.

Inheritance relationships

Inheritance from a series of parent-child relationships is multilevel whereas inheritance of two or more children from a single parent—sometimes super—is hierarchical.