class Student(object):
count = 0
def __init__(self, name):
self.name = name
Student.count+=1
说明:其中count为类属性,为Student的属性
Sign in to make a reply
一颗美美哒心
class Student(object):
count = 0
def __init__(self, name):
self.name = name
Student.count+=1
说明:其中count为类属性,为Student的属性