class Animal: def __init__(self, name): self.name = name def talk(self): pass ####多态 @staticmethod def animal_talk(obj): obj.talk() class Cat(Animal): def talk(self): print('Meow!') class Dog(Animal): def talk(self): print('Woof! Woof!') d = Dog("哈士奇") #d.talk() c = Cat("苗") ###要调用谁就把谁传进去 Animal.animal_talk(c) Animal.animal_talk(d)