day07_03 类方法与类变量
__author__ = "Alex Li"
import os
# os.system()
# os.mkdir()
class Dog(object):
name = "huazai"
def __init__(self,name):
self.name = name
#只能访问类变量,不能访问实例变量,强制使用类变量
@classmethod
def eat(self):
print("%s is eating %s" %(self.name,'dd'))
def talk(self):
print("%s is talking"% self.name)
d = Dog("ChenRonghua")
d.eat()