Python 官方文档:入门教程 => 点击学习
#!/usr/bin/env pythonclass father(object): def __init__(self,tail,heav): self.tail=tail self.heav=heavclass mother(obje
#!/usr/bin/env python
class father(object):
def __init__(self,tail,heav):
self.tail=tail
self.heav=heav
class mother(object):
def __init__(self,like,eat):
self.like=like
self.eat=eat
#class xiaoming(mother):
# pass
class xiaoming(father,mother):
def __init__(self,father_tail,father_heav,mother_like,mother_eat):
father.__init__(self,father_tail,father_heav)
mother.__init__(self,mother_like,mother_eat)
xm=xiaoming('father_178','father_75','mother_like','mother_eat')
print "this is father self:",xm.tail,xm.heav
print "this is mother self:",xm.like,xm.eat
--结束END--
本文标题: python 继承2个父类
本文链接: https://lsjlt.com/news/186788.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0