class:
A class of things with the same attributes and skills.
object:
the specific performance of the class.
class keyword
Class Name: (class name should be capitalized first)
code block.
country = ' China ' first part: Static variable, static field
def __init__ (self,name,age): Part Two: Dynamic methods, functions, methods
Pass
def func (self):
Pass
the structure of the class is divided into two parts.
class Name:
#1, class name. __dict__
#2, class name. Country (class name. __dict__[' Country ') is not recommended and cannot be modified or deleted.
class name. Variable names can be changed or deleted.
#3, class name. Func (111)
object:
obj1 = class name ()
1, in memory created an empty! Object space.
2, automatically executes the __init__ (self), and passes the empty object space
3, in the __init__ method, the empty object space encapsulates some properties, and then the perfect space is returned to the class name (), the object.
# 1, the object looks at all the properties of its own space:
obj.__dict__
# 2, the object operates its own properties. A universal point.
obj. Attribute name (add-and-revise check.)
# 3, an object can query a static field in a class.
obj. static field.
# 4, the object executes the method in the class.
obj. Method name ()
Python basics-Object-oriented initialization