为了账号安全,请及时绑定邮箱和手机立即绑定

StudentBasketball的构造函数改怎么写?

# Enter a code

#encoding=utf-8

class Person(object):

    def __init__(name,gender):

        self.name=name

        self.gender=gender

        

    def who(self):

        return 'I'm a person,my name is %s' %s self.name

        

class Student(Person):

    def __init__(self,name,gender,score):

        super(Student,self).__init__(name,gender)

        self.score=score

        

    def who(self):

        return 'I'm a student,my score is %s' % self.score

        

class Teacher(Person):

    def __init__(self,name,gender,course):

        super(Teacher,self).__init__(name,gender)

        self.course=course

        

    def who(self):

        return 'I'm a Teacher,my course is %s' % self.course

        

        

class SkillMixin(objetc):

    def __init__(self,ball):

        self.ball=ball

        

    def skill(self):

        return 'I can play %s' % self.ball

        

class BasketballMixin(SkillMixin):

    def __init__(self,ball,basketball):

        super(BasketballMixin,self).__init__(ball)

        self.basketball=basketball

        

    def skill(self):

        return 'I can play %s' % self.basketball

        

class FootballMixin(SkillMixin):

    def __init__(self,ball,football):

        super(FootballMixin,self).__init__(ball)

        self.football=football

        

    def skill(self):

        return 'I can play %s' % self.football

        

class StudentBasketball(Student,BasketballMixin):

    def __init__(self,name,gender,score,skill):        #对吗

        super(StudentBasketball,self).__init__()        #不会写了


        


正在回答

1 回答

# Enter a code
# encoding=utf-8
class Person(object):
    def __init__(self, name, gender):
        self.name = name
        self.gender = gender

    def who(self):
        return "I'm a person, my name is %s" % self.name


class Student(Person):
    def __init__(self, name, gender, score):
        super(Student, self).__init__(name, gender)
        self.score = score

    def who(self):
        return "I'm a student, my score is %s" % self.score


class Teacher(Person):
    def __init__(self, name, gender, course):
        super(Teacher, self).__init__(name, gender)
        self.course = course

    def who(self):
        return "I'm a Teacher, my course is %s" % self.course


class SkillMixin(object):
    def __init__(self, ball):
        self.ball = ball

    def skill(self):
        return 'I can play %s' % self.ball


class StudentBasketball(Student, SkillMixin):
    def __init__(self, name, gender, score, ball):  # 对吗
        Student.__init__(self, name, gender, score)
        SkillMixin.__init__(self, ball)


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

StudentBasketball的构造函数改怎么写?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信