class Hum:
def __init__(self,name,age):
self.name = name
self.age = age
class Stu(Hum): # inherit class Hum
def __init__(self,name,age,score):
Hum.__init__(self,name,age)
self.score = score
def tell(self):
print 'Name:',self.name
print 'Age:' ,self.age
print 'Score:',self.score
s=Stu('Sam',30,90)
s.tell()
版权声明:本文为博主原创文章,未经博主允许不得转载。