I made a program named as a title.py inside it used Inheritance , now I want to Extend the Parent Class in another program(file also) but having an Error lets check ,my code <br><br><br>1.first file title .py <br><br>class global Studentdatabase:<br>
def __init__(self,name,age,standard,place,dateofbirth,sex):<br> <a href="http://self.name">self.name</a>=name<br> self.age=age<br> self.standard=standard<br> self.place=place <br> self.dateofbirth=dateofbirth<br>
self.sex=sex <br> print 'Initalizing',<a href="http://self.name">self.name</a><br> def tell(self):<br> 'TELL DETAILS'<br> print 'NAME,AGE,STANDARD,PLACE,DATEOFBIRTH,SEX',<a href="http://self.name">self.name</a>,self.age,self.standard,self.place,self.dateofbirth,self.sex<br>
class Teacher(Studentdatabase):<br> def __init__(self,name,age,standard,place,dateofbirth,sex,salary):<br> Studentdatabase.__init__(self,name,age,standard,place,dateofbirth,sex)<br> self.salary=salary <br>
print 'name is ',<a href="http://self.name">self.name</a> <br> def tell(self):<br> Studentdatabase.tell(self)<br> print 'The salary is',self.salary <br>class Student(Studentdatabase):<br>
def __init__(self,name,age,standard,place,dateofbirth,sex,marks):<br> Studentdatabase.__init__(self,name,age,standard,place,dateofbirth,sex)<br> self.marks=marks <br> print 'The name',<a href="http://self.name">self.name</a><br>
def tell(self):<br> Studentdatabase.tell(self)<br> print 'The marks is',self.marks <br>t=Teacher('Mr.sudhanshu',21,'B.E','Jaipur','12/02/1986','MALE',21000)<br>
s=Student('Anirudh',19,'Engineering','Delhi','12/3/1989','MALE',65)<br>members=[t,s]<br>for member in members:<br> member.tell()<br> <br><br><br><br>2.Now another file in which I want to extend that same parent class is here .First code running successfully but in another one having problem <br>
<br><br><br><br>'This another source code will represent the new Entry of database'<br>import title <br>class Newstudent(Studentdatabase):<br> def __init__(self,name,age,standard,place,dateofbirth,sex,marks):<br>
Studentdatabase.__init__(self,name,age,standard,place,dateofbirth,sex)<br> self.marks=marks<br> print 'The new data base has name of new students',<a href="http://self.name">self.name</a> <br>
def tell(self):<br> Studentdatabase.tell(self)<br> print 'The marks of the student is',self.marks <br> <br>s1=Newstudent('Rajiv',21,'M.B.A','MUMBAI','12 JAN,1987','MALE',267)<br>
s2=Newstudent('VIKASH',22,'M.B.A','DELHI','12 JAN 1985','MALE',234)<br>s3=Newstudent('SAURAV',23,'B.TECH','BIHAR','12 JAN 1984','MALE',233)<br>
new=[s1,s2,s3]<br>for newstudent in new:<br> newstudent.tell()<br><br><br><br>Now tell me that how I can extend it <br><br>regards <br>sudhanshu <br>:) <br><br> <br><br><br><br><br>