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)
Sign in to make a reply
想这挺好