摘要:
class Student(object): #静态变量 count=0 def __init__(self, name): Student.count+=1 def show(self): print Student.count #静态方法1 @staticmethod def haha(): print Student.count #静态方法2 @classmethod def ss(cls): print cls.count 阅读全文
程序猿刚子的博客大龄程序猿,分享互联网开发相关知识!前端、后端,架构等内容,欢迎关注公众号 chengxuyuangangzi |
|
摘要:
class Student(object): #静态变量 count=0 def __init__(self, name): Student.count+=1 def show(self): print Student.count #静态方法1 @staticmethod def haha(): print Student.count #静态方法2 @classmethod def ss(cls): print cls.count 阅读全文
|