class Person(object):? ? __count = 0? ? @classmethod? ? def how_many(cls):? ? ? ? return cls.__count? ? def __init__(self, name):? ? ? ? self.name = name? ? ? ? Person.__count = Person.__count + 1print Person.how_many()p1 = Person('Bob')print Person.how_many()
最后三行中兩個print分別對應哪個?運行出結果是0和1
xinxin_121
2016-05-28 16:37:32