7_20 day25 14min 静态属性
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
@property
def cal_area(self):
# print('%s 住的 %s 总面积是%s' % (self.owner,self.name, self.width * self.length))
return self.width * self.length
r1=Room('厕所','alex',100,100,100000)
print(r1.cal_area) //100000
封装了,隐藏过程,可以像数据属性一样调用