课程
/后端开发
/Python
/python进阶
为啥参考答案通不过?
2016-09-20
源自:python进阶 2-4
正在回答
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()
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()
举报
学习函数式、模块和面向对象编程,掌握Python高级程序设计
购课补贴联系客服咨询优惠详情
慕课网APP您的移动学习伙伴
扫描二维码关注慕课网微信公众号