#继承 #重载,对继承过来的特征重新定义 #父类,基类 #子类,派生类 #继承:单继承-继承一个父类,多继承-继承多个父类 class father(): def speak(self): print("i can speak") #单继承 class son(father): pass s=son() s.speak() class mother(): def write(self): print("i can write") #多继承,并且有自己的能力 class daughter(father,mother): def listen(self): print("i can listen") d=daughter() d.speak() d.write() d.listen() #重写,重载 class son2(father): def speak(self): print("i can speak 2!") s=son2() s.speak()