Features and Types of Inheritance
Explore the core features of inheritance in Python, including how to inherit, suppress, and extend methods. Understand different inheritance types such as simple, multilevel, and multiple inheritance along with the diamond problem and Python's method resolution order to manage ambiguity.
We'll cover the following...
We'll cover the following...
Features of inheritance
Inheritance facilitates three things:
- Inheritance of an existing feature: To implement this, just establish inheritance relationship.
- Suppressing an existing feature: To implement this, hide base class implementation by defining the same method in the derived class.
- Extending an existing feature: To implement this, call base class method from the derived class by using one of the following two forms:
super().base_class_method