7_20 day24 13min 静态方法
class Room:
tag=1
def __init__(self,name,owner,width,length,heigh):
self.name=name
self.owner=owner
self.width=width
self.length=length
self.heigh=heigh
@staticmethod#类工具包,不和类也不和实例绑定,不能调用类,实例变量
def wash_body(a, b, c):
print('%s %s %s正在洗澡' % (a, b, c))
def test(x, y):
print(x, y)
Room.wash_body('alex','yuanhao','wupeiqi')
r1=Room('厕所','alex',100,100,100000)
print(Room.__dict__)
print(r1.__dict__)
浙公网安备 33010602011771号