python 函数私有方法

#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

  

posted @ 2017-10-22 10:27  timtike  阅读(701)  评论(0编辑  收藏  举报