# -*- coding: utf-8 -*-
class Animal:
def eat(self):
print(‘Animal is eating...‘)
class Bird(Animal):
def sing(self):
print(‘Brids is singing...‘)
def eat(self):
print(‘Brid is eating...‘)
class Dog(Animal):
def laugh(self):
print(‘Dogs is laughing...‘)
#def eat(self):
#print(‘Dog is eating...‘)
pass
a = Animal()
# a.eat()
#
b = Bird()
# b.eat()
# b.sing()
#
d = Dog()
# d.eat()
# d.laugh()
def demo_eat(q):
q.eat()
for iteam in [a, b, d]:
demo_eat(iteam)
原文:https://www.cnblogs.com/xixirangrang/p/13339741.html