Follow the development of Python in old boy education [Article 7]: Object-oriented 2, old boy python
Static Field application:
Generally, you can access your own fields.
Rule: common fields can only be accessed by objects, and static fields can be accessed by classes (object access is allowed ).
Static fields have been created when the code is loaded.
Common, static, and class methods
Singleton mode: class method.
All methods belong to the class:
1. A common method, at least one self, executes the object.
2. Static methods, arbitrary parameters, and class execution (Object execution is allowed ).
3. Class method, at least one cls, class execution (Object execution is allowed ).
Class member attributes
Attribute: method-based writing and field-based access.
PRIVATE: only the members of the class can access it.
Note: special methods for accessing private fields (_ class name_xxx ).
Print (obj. _ Foo _ age)
Isinstance and issubclass inherit super
Ordered dictionary Singleton Mode
The Singleton mode is used to create a single instance.