Object-Oriented Programming
What Is Inheritance in OOP?
Inheritance lets a class reuse and extend the attributes and methods of another class, called its parent or superclass.
Definition
Inheritance is an object-oriented feature where a new class (the child or subclass) is based on an existing class (the parent or superclass). The child gets the parent’s attributes and methods and can add or change them.
It models an "is a" relationship: a car is a vehicle, and a savings account is an account.
How it works
In Java the child declares extends Parent; in Python it is class Child(Parent). The child can override a method by defining one with the same name, and call the parent’s version through super.
Java and C# allow one parent class per class, plus any number of interfaces. Python and C++ allow several parents.