打印啥?

class Animal(object):
    hobby = "eat"

    def run(self):
        print(self.hobby)
        return self.hobby


class Dog(Animal):
    hobby = "sleep"


dog = Dog()
print(dog.hobby)    
print(dog.run())  

 

答案

sleep
sleep
sleep
View Code

相关文章:

  • 2022-01-25
  • 2021-09-14
  • 2021-11-28
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-01
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
相关资源
相似解决方案