麻烦看一下,我哪里不对 python进阶 4-10定义类方法
class Person(object):
__count = 0
@classmethod
def honw_many(cls):
return cls.__count
def __init__(self,name):
self.name=name
Person.__count=Person.__count+1
print Person.how_many()
p1 = Person('Bob')
print Person.how_many()