博客
关于我
python中的super函数
阅读量:588 次
发布时间:2019-03-11

本文共 231 字,大约阅读时间需要 1 分钟。

p y t h o n 中 的 s u p e r 函 数 python中的super函数 pythonsuper

super() 函数是用于调用父类(超类)的一个方法。

class A:     def add(self, x):         y = x+1         print(y)class B(A):    def add(self, x):        super().add(x)b = B()b.add(2)  # j结果:3

转载地址:http://kdctz.baihongyu.com/

你可能感兴趣的文章
netty时间轮
查看>>
Netty服务端option配置SO_REUSEADDR
查看>>
Netty核心模块组件
查看>>
Netty框架内的宝藏:ByteBuf
查看>>
Netty框架的服务端开发中创建EventLoopGroup对象时线程数量源码解析
查看>>
Netty源码—1.服务端启动流程一
查看>>
Netty源码—1.服务端启动流程二
查看>>
Netty源码—2.Reactor线程模型一
查看>>
Netty源码—2.Reactor线程模型二
查看>>
Netty源码—3.Reactor线程模型三
查看>>
Netty源码—3.Reactor线程模型四
查看>>
Netty源码—4.客户端接入流程一
查看>>
Netty源码—4.客户端接入流程二
查看>>
Netty源码—5.Pipeline和Handler一
查看>>
Netty源码—5.Pipeline和Handler二
查看>>
Netty源码—6.ByteBuf原理一
查看>>
Netty源码—6.ByteBuf原理二
查看>>
Netty源码—7.ByteBuf原理三
查看>>
Netty源码—7.ByteBuf原理四
查看>>
Netty源码—8.编解码原理一
查看>>