关于Python中继承的格式总结

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于Python中继承的格式总结相关的知识,希望对你有一定的参考价值。

自己总结一下继承的格式

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

以上是关于关于Python中继承的格式总结的主要内容,如果未能解决你的问题,请参考以下文章