# 多态-
class Dog(object):
def __init__(self,name):
self.name=name
def game(self):
print("开心地玩帅")
class XiaoTianDog(Dog):
def game(self):
print("play in the sky")
class Person(object):
def __init__(self,name):
self.name=name
def play_with_dog(self,dog):
print(f"{self.name} 和 {dog.name} ")
dog.game()
a=Dog("土狗")
xiaoming=Person("小明")
xiaoming.play_with_dog(a)
b=XiaoTianDog("神奇狗狗会飞翔")
xiaoming.play_with_dog(b)