自己总结一下继承的格式
class Father:
def__init__(self,Y1,Y2):
self.X1=Y1
selfX2=Y2
def tell(self):
print’this is “%s”and”%s”:’%(self.X1,self.X2)
class son(Father):
def__init__(self,Y1,Y2,Y3):
Father.__init__(self,Y1,Y2)
Self.X3=Y3
def tell:
Father.tell(self)
print’this is “%s”’%self.X3
时间: 2024-11-05 04:39:49