#封装的扩展性高
class Room:
def __init__(self, name, owner, height, weight, lenght):
self.name = name
self.owner = owner
self.__height = height
self.__weight = weight
self.__lenght = lenght
def tell_area(self):
return self.__weight * self.__lenght * self.__height
a = Room('王八壳', '老王', 10, 10 ,10)
print(a.tell_area())
#用户无需知道程序内部干啥,用户只需要知道我需要什么结果,就去执行那个调用即可
#比如有个按钮是可计算面积的,用户只需要点击这个按钮即可