Python--继承

Posted 王思磊

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python--继承相关的知识,希望对你有一定的参考价值。

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--继承的主要内容,如果未能解决你的问题,请参考以下文章