码迷,mamicode.com
首页 > 编程语言 > 详细

Python--继承

时间:2018-02-09 20:20:06      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:nim   ret   mon   pre   python   body   class   fat   pass   

class WslFather(object):
@property
def money(self):
return 1000000000

def smoke(self):
self.yan = ‘玉溪‘
print(‘抽烟‘)

def drink(self):
print(‘喝酒‘)

def tangtou(self):
print(‘烫头‘)


class Wsl(WslFather):
def driver(self):
print(‘开车‘)


# xlh = Wsl()
# xlh.smoke()
# xlh.drink()
# xlh.tangtou()
# print(xlh.money)
# print(xlh.yan)
class Animal(object):
def eat(self):
print(‘吃‘)

def huxi(self):
print(‘呼吸‘)


class Brid(Animal):
pass

Python--继承

标签:nim   ret   mon   pre   python   body   class   fat   pass   

原文地址:https://www.cnblogs.com/wangsilei/p/8436058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!