您的位置:首页 > 编程语言 > Python开发

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

  

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: