10.1 Inheritance

Two concepts to know in Inheritance.

  1. >super(): This is a built-in function used to access any child's/parent's methods/variables inside of a child class, it is very similar to super keyword in Java. When this function is called it returns a temporary object of parent class which then can be used to access all of its methods/variables.
  2. >Method Resolution Order (MRO): Is the order in which Python looks for a method in the hierarchy of classes. The general order is child -> parent1 -> parent2... When a method/variable is searched, it is looked up in this order. Any name collision is avoided by following this order.

10.1.1 Four types of Inheritance.

1. Single:

2. Multiple:

3. Multilevel:

4. Hierarchical: