class Animal(object): def eat(self): print('动物会吃') class Dog(Animal): def eat(self): print('Dogggggggg') class Cat(Animal): def eat(self): print('Cattttttt') class Person(Animal): def eat(self): print('Person') ####定义一个函数 def fun(obj): obj.eat() ###开始调用函数 fun(Cat()) fun(Dog()) fun(Animal()) print('-------------') fun(Person())