class annamal:
def chi(self):
print(self.name + '吃')
def he(self):
print(self.name + '喝') class dog(annamal):
def __init__(self,name):
self.name = name
def bark(self):
print(self.name+' auhhh...')
pp = dog('AA')
pp.chi()
pp.he()
pp.bark()
python 多继承
class Alex:
def f1(self):
print('alex') class A(Alex):
def f(self):
print('A')
class B(Alex):
def f(self):
print('B')
class C(A):
def f(self):
print('C')
class D(B):
def f(self):
print('D')
class E(C,D):
def f(self):
print('E')
obj = E()
obj.f1()