码迷,mamicode.com
首页 > 其他好文 > 详细

超继承

时间:2019-12-15 16:55:28      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:重写   class   sel   对象   The   int   子类   self   elf   



class Father:

def f1(self):
print(‘hello‘)

class Son(Father):

def f1(self):
super(Son, self).f1() # super格式:(子类,对象).重写的方法
print(‘world‘)


obj = Son()
obj.f1()

超继承

标签:重写   class   sel   对象   The   int   子类   self   elf   

原文地址:https://www.cnblogs.com/jinbaobao/p/12044383.html

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