摘要:
class Stuent(object): stu_num = 0 __stu_num = 0 name = 333 def __init__(self,name): self.name = name # self.stu_num += 1 # 这就相当于对实例进行了赋值 Stuent.stu_nu 阅读全文
摘要:
#类方法通过@classmethod 装饰器实现# 类方法和普通方法的区别是,类方法只能访问类变量,不能访问实例变量class Dog(): name = "stupid_dog" def __init__(self,name): self.name = name @classmethod def 阅读全文