1, with the object class
Description :
- class
- Class is an abstract of a number of objects (understood as a concept)
- The role of class: create an object, subclassed
- Objects
- That there's a specific thing
- The role of the object: instance variable operating object (including the value of access instance variables, instance variables add, delete instance variables), the operation object methods (including calling the method, adding method, delete method)
Syntax :
class 类名:
'''
说明
'''
执行语句... (定义类时自动执行)
零到多个类变量...
零到多个方法...
class Item:
'''
Item 类
'''
print('Item')
# 类变量
itemtype = '电子产品'
itemcolor = '未知'
# 方法
def foo():
pass
Item