代码实现:

class Animal: def init(self, name, age, gender): self.name = name self.age = age self.gender = gender

def eat(self):
    print("Animal is eating")

class Cat(Animal): def eat(self): print("Cat is eating")

def catch_mouse(self):
    print("Cat is catching mouse")

class Dog(Animal): def eat(self): print("Dog is eating")

def watch_house(self):
    print("Dog is watching house")

原文地址: https://www.cveoy.top/t/topic/fEvY 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录