access.py 230 B

123456789101112131415161718
  1. class Test:
  2. def __init__(self, foo):
  3. self.__foo = foo
  4. def __bar(self):
  5. print(self.__foo)
  6. print('__bar')
  7. def main():
  8. test = Test('hello')
  9. test._Test__bar()
  10. print(test._Test__foo)
  11. if __name__ == "__main__":
  12. main()