#coding=utf-8 class SchoolMember: def __init__(self,name,age): self.name=name self.age=age print 'SchoolMember:%s' %self.name def tell(self): print "Name:'%s' Age:'%s'"%(self.name,self.age) class Teacher(SchoolMember): def __init__(self,name,age,salary): SchoolMember.__init__(self,name,age) self.salary=salary print('初始化Teacher:%s'%self.name) def tell(self): SchoolMember.tell(self) print("Salary:'%d'" %self.salary) class Student(SchoolMember): def __init__(self,name,age,mark): SchoolMember.__init__(self,name,age) self.mark=mark print('初始化Teacher:%s'%self.name) def tell(self): SchoolMember.tell(self) print("Mark:'%d'" %self.mark) t=Teacher('Mrs.Sun',40,30000) s=Student("555",22,75) print #prints a blank line members=[t,s] for member in members: member.tell()