立即学习:https://edu.csdn.net/course/play/10443/223253?utm_source=blogtoedu
0,类的初始化
def __init__(self,x,y): #创建对象时执行
self.x=x
self.y=y
1,类的属性
class 类名:
属性1= “xxx”
属性2= 100
2,类的方法(函数)
def 函数名(self):
self : 表示当前类的 意思,是一个指针
print(self.属性)
3,创建实例对象
对象名 = 类名()