继承

 class Zoo():
  2     def sleep(self):
  3         print('---睡觉---')
  4     def eat(self):
  5         print('---吃----')
  6     def run(self):
  7         print('--跑--')
  8 class Dog(Zoo):
  9     def cry():
 10         print('---叫---')
 11 class Cat():
 12     def grab(self):
 13         print('---zhua--- ')
 14 a = Zoo()
 15 a.eat()
 16 wangcai = Dog()
 17 wangcai.run()
~                       

 

posted @ 2018-04-20 11:17  Smalllv  阅读(90)  评论(0编辑  收藏  举报