博客
关于我
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/

你可能感兴趣的文章
nginx工作笔记005---nginx配置负载均衡_在微服务中实现网关集群_实现TCP传输层协议__http协议的负载均衡
查看>>
nginx常用命令及简单配置
查看>>
Nginx常用屏蔽规则,让网站更安全
查看>>
Nginx常见问题
查看>>
nginx平滑升级解决 nginx 安全漏洞(CVE-2021-23017)和NGINX 环境问题漏洞(CVE-2019-20372)
查看>>
Nginx平滑添加模块
查看>>
Nginx开启gzip网页传输压缩配置
查看>>
nginx开机启动脚本
查看>>
nginx异常:the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf
查看>>
nginx总结及使用Docker创建nginx教程
查看>>
nginx报错:the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:128
查看>>
nginx报错:the “ssl“ parameter requires ngx_http_ssl_module in usrlocalnginxconfnginx.conf128
查看>>
Nginx搭建RTMP服务器+FFmpeg实现海康威视摄像头预览
查看>>