Inheritance in OOP
is similar to genetic inheritance in real life. The classes assume or take over characteristics from a parent class. We have four types of this in Python:
- Single inheritance
- Multiple inheritance
- Multilevel inheritance
- Hierarchical inheritance
The figure below will give you a basic idea of each type.
Encapsulation
is a process in which we enclose our values. We gather all the data and methods at one place.
Polymorphism
is a process that defines multiple ways to perform a single action. It is a property of the object that allows it to take multiple forms. There are two types of polymorphism in Python:
- Run-time polymorphism
- Compile-time polymorphism
Abstraction
is a when we hide system details or complexities from end users. When we create an abstract class, it can't have any objects. This class just provides functions for other classes to inherit.