1, object-oriented Most important concepts are classes (class) and instances (Instance), classes are abstract templates, and instances are based on the class created by a specific "object", each object is have the same method , but their data may be different.
2, in the class of the internal definition of access to the data function, the data encapsulated, these and class data associated with the function, called the method of the class.
3, __ The variable is a private variable, only internal access, if you want to modify the external code, you can add methods Inside.
4, after inheritance, the subclass has all the functions of the parent class (method), another benefit of inheritance is polymorphism: open to the Extension--can be added to the parent class subclass, the modification is closed--do not need to modify the dependent parent class function (open and close Principle)
5.
For a static language, such as java, if an incoming Animal type is required, the incoming object must be a Animal type or its subclass, otherwise the method cannot be called run() .
For dynamic languages such as python, the incoming type is not necessarily required Animal . we just need to make sure that the incoming object has a run() method.
The characteristics of duck type in dynamic language determine that inheritance is not necessary as a static language.
Python-learning Note 1-object-oriented Programming