class Student(object): count = 0 def __init__(self, name): self.name = name Student.count = Student.count+1
实例self 可以访问到Student类的属性,count。每创建一个实例,类属性count就加1
Sign in to make a reply
AL
实例self 可以访问到Student类的属性,count。每创建一个实例,类属性count就加1