python 函数私有方法
2017-10-22 10:27
357 查看
#coding:utf-8 class A(object): def _test1(self): print('this is _test1') def test2(self): print('this is test2') def __test3(self): print('__test3') class B(A): def run(self): self._test1() self.test2() self._A__test3() b = B() a = A() a._A__test3() b.run()
结果
__test3 this is _test1 this is test2 __test3
相关文章推荐
- 跟老齐学Python之私有函数和专有方法
- python 对私有属性(方法)的访问 的函数
- 跟老齐学Python之私有函数和专有方法
- Python之私有函数和专有方法
- python中类的设计问题(一些高级问题探讨,函数重载,伪私有,工厂模式,类方法等)
- Python的hasattr() getattr() setattr() 函数使用方法详解
- Python类里的__init__方法函数,Python类的构造函数
- Python 读Dict数据的方法,解决key 不在dict的问题,get()函数,setdefault()函数
- Python内建函数与对象方法
- 笨方法学Python 习题 21: 函数可以返回东西
- Python中Function(函数)和methon(方法)
- Python的numpy库中将矩阵转换为列表等函数的方法
- Python网络编程调用recv函数完整接收数据的三种方法
- python 字符串常用函数方法整合
- Python 私有变量、私有方法、类变量与实例变量
- [python] 类常用的内置方法和函数
- python函数返回多个值的示例方法
- Python的hasattr() getattr() setattr() 函数使用方法详解
- python双下划线含义、MethodType把函数变为方法以及类继承
- python2.x中函数在python3.x中的改动方法