Py学习  »  Python

python类多继承求指点错误

547899883 • 6 年前 • 332 次点击  

coding=utf-8

class student(object):

"""docstring for student"""
def __init__(self, age, height):
    self.age = age
    self.height = height
    print("student初始化")
def play(self):
    print("学生爱好什么")

class hong(student):

"""docstring for hong"""
def __init__(self, age, height, sex = 'woman'):
    super(hong, self).__init__(age, height)

    self.sex = sex
    print("hong初始化")

def play(self):
    print("小红爱好画画")

class ming(object):

"""docstring for ming"""
def __init__(self,  love):
    self.love = love
    print("ming初始化")

def play(self):
    print("小明爱好打游戏")

class alllove(hong,ming):

"""docstring for alllove"""
def __init__(self):
    super(alllove, self).__init__(age, love)

def play(self):
    # super().play
    print("大家的爱好就是这样")

alllove().play()

求指点这么写有什么错误啊· py3.6.2运行不行,本人小白,求教

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/4418
 
332 次点击  
文章 [ 2 ]  |  最新文章 6 年前
547899883
Reply   •   1 楼
547899883    6 年前

😂了解了 · 参数没给值

547899883
Reply   •   2 楼
547899883    6 年前

求大佬指点,刚学有点懵