0
点赞
收藏
分享

微信扫一扫

python-day16

ixiaoyang8 2023-09-24 阅读 19

class animal:
    def eat(self):
        print('animal will eat')
class dog(animal):
    def eat(self):
        print('dog is eating bone')
class cat(animal):
    def eat(self):
        print('cat is eating fish')
class person:
    def eat(self):
        print('people is eating corn')
def fun(obj):
    obj.eat()
fun(animal)
fun(dog())
fun(cat())
fun(person())

举报

相关推荐

Python版day16

python_day16_设计模式

Day16

leetcode-day16

day16_IO

day16-DOM

0 条评论