class Person:
def __init__(self,name):
self.name=name
print("person class is called")
class Teacher:
def __init__(self,fname,lname):
self.fname=fname
self.lname=lname
print("Techer class is called")
class Student(Person , Teacher):
def __int__(self,sub,grade,name,fname,lname):
self.sub=sub
self.grade=grade
Person.__init__(self,name)
Teacher.__init__(self,fname,lname)
print("student class is called")
def getdata(self):
print("subject name:",self.sub,"grade is:",self.grade)
print("teacher name:",self.fname)
std1=Student("english","7.0","ravi","raj","savaliya")
std1.getdata()
答案 0 :(得分:2)
您有一个错字__int__
-> __init__
。代替
class Student(Person , Teacher):
def __int__(self,sub,grade,name,fname,lname):
应该有
class Student(Person , Teacher):
def __init__(self,sub,grade,name,fname,lname):