Inheritance: Subclasses (derived classes) inherit everything from the parent class (the base class)
The most important feature of inheritance: Save code; associated with other classes.
Why can subclasses find all of the parent classes?
Because the concept of a parent class pointer exists
Categories of inheritance:
1, Version Category:
python3.x:
class inherits the object class by default, and the class that inherits the object class is called the new class
python2.x:
Class is not inherited by default, and classes that do not inherit object are called Classic classes. If you let him inherit the object class in python2.x, it becomes a new class.
2, according to the classification of inheritance:
Single inheritance: Query order always up (new class, classic Class)
Methods for inheriting a parent class in a subclass: 1, object.__init__ (self, *args); 2, Super (). __init__ (*args)
Multiple inheritance:
New class: Breadth-first and breadth algorithms: walk through each node with the fewest number of times, each node, and only once Object.mro () find the inheritance order.
Classic class: Depth first: One way to the black.
Oldboy Twentieth Day. I Love Python. Object-Oriented inheritance: