1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
class XiaomuFather(object): def talk(self): print('小慕的爸爸说了一句话')
def jump(self): print('大家都可以跳')
class XiaomuBrother(XiaomuFather): def run(self): print('小慕哥哥在奔跑着')
def talk(self): print('小慕哥哥在说话')
class Xiaomu(XiaomuFather): def talk(self): print('haha 小慕也可以说自己的观点')
if __name__ == '__main__': xiaomu_brother = XiaomuBrother() xiaomu_brother.run() xiaomu_brother.talk() xiaomu_brother.jump() father = XiaomuFather() father.talk() xiaomu = Xiaomu() xiaomu.talk() xiaomu.jump()
|