立即学习:https://edu.csdn.net/course/play/26676/339581?utm_source=blogtoedu
单继承,class C(P): C类继承父类P。
1、子类里的重名方法会覆盖父类同名的方法。重写。
P.__init__(self,name)
super().__init__(self,name),适用于单继承
多继承,class C(P1,P2)。 __mro __算法,按照该算法查找C的方法。
立即学习:https://edu.csdn.net/course/play/26676/339581?utm_source=blogtoedu
单继承,class C(P): C类继承父类P。
1、子类里的重名方法会覆盖父类同名的方法。重写。
P.__init__(self,name)
super().__init__(self,name),适用于单继承
多继承,class C(P1,P2)。 __mro __算法,按照该算法查找C的方法。