#多重继承
1 class Person: 2 def __init__(self,name): 3 self.name=name 4 def eat(self): 5 print('------->eat1') 6 def eat(self): 7 print('---------->eat2') 8 9 p=Person('hiug') 10 p.eat()
#一个子类可以继承多个父类
#多重继承
1 class A: 2 def test1(self): 3 print('-------------------->AAAAAAA') 4 class B: 5 def test2(self): 6 print('-------------------->BBBBBBB') 7 class C(A,B): 8 def test3(self): 9 print('--------------------->CCCCCCC') 10 11 c=C() 12 c.test1() 13 c.test2() 14 c.test3()