python__基础 : 类的继承,调用父类的属性和方法

1.继承,调用父类属性方法html 在python里面,继承一个类只须要这样写:python class Animal: def heshui(self): print('动物正在喝水') class Cat(Animal): pass 这样Cat就有了Animal的全部属性和方法,调用的时候直接调用就能够了:post #接上面代码 cat = Cat() c
相关文章
相关标签/搜索