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

python多重继承

时间:2018-12-29 15:14:29      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:sel   多重   pre   眼睛   双眼皮   class   coding   ini   int   

#-*-coding:utf-8-*-
‘‘‘
多重继承
‘‘‘

class MyFather:
def __init__(self):
self.eyes = ‘爸爸的眼睛是双眼皮‘
print(self.eyes)
class MyMother:
def __init__(self):
self.forehead = ‘妈妈的额头有点宽‘
print(self.forehead)
class MyAunt:
def __init__(self):
self.nose=‘姑姑的鼻子是高鼻梁‘
print(self.nose)
class MySelf(MyFather,MyMother,MyAunt):
def __init__(self,face):
print(‘我的眼睛是双眼皮,别人说我继承的是:‘)
MyFather.__init__(self)
print(‘我的额头有点宽,别人说我继承的是:‘)
MyMother.__init__(self)
print(‘我的鼻子有点高,还有人说我继承的是:‘)
MyAunt.__init__(self)
self.face = face
print(‘我的脸型:%s‘%self.face,‘这下终于没人说我像谁了‘)
myself = MySelf(‘偏圆吧‘)

python多重继承

标签:sel   多重   pre   眼睛   双眼皮   class   coding   ini   int   

原文地址:https://www.cnblogs.com/askill/p/10195938.html

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