码迷,mamicode.com
首页 > 编程语言 > 详细

关于Python中继承的格式总结

时间:2017-09-06 13:08:02      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:bsp   sel   pytho   self   fat   关于   init   class   elf   

自己总结一下继承的格式

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中继承的格式总结

标签:bsp   sel   pytho   self   fat   关于   init   class   elf   

原文地址:http://www.cnblogs.com/ferryCaptain-cloud/p/7483731.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!