Python __ 面向对象基础 import math as m class Rect: l = 0.0 h = 0.0 z = 0.0 def __init__(self, l, h, z): self.l = l self.h = h self.z = z def length(self):
7-2 sdut-o..从图中观察,可抽取长方体和四棱锥两种立体图形的共同属性到父类Rect中:长度:l 宽度:h 高度:z。(1)在父类Rect中,定义求底面周长的方法length( )和底面积的方法area( )。
上一篇Python __ 面向对象基础 下一篇7-4 sdut-oop-5 计算长方体和四棱锥的表面积和体积(类的继承) python 本文作者:kingwzun 本文链接:https://www.cnblogs.com/kingwz/p/16333626.html 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。