Discuss / Python / 学习了,留个脚印

学习了,留个脚印

Topic source

想这挺好

#1 Created at ... [Delete] [Delete and Lock User]
class Human(object):
    def eat(self):
        return 'human need to eat'
    def have(self,heart):
        self.heart=heart
class Animal(object):
    def learning(self):
        return 'Animal need to learn'
    def need(self,water):
        self.water=water
    def have(self,heart):
        self.heart=heart+'animal'
class Kid(Animal,Human):
    pass
zhou=Kid()
zhou.have('xinzang')
zhou.need('chunjinshui')
print(zhou.eat())
print(zhou.learning())
print(zhou.heart)
print(zhou.water)

  • 1

Reply