Program - Public vs. private class methods and name mangling


Topic: Program - Public vs. private class methods and name mangling

Solution

    def public_method(self):
        print('Hello public world!')
    def __private_method(self):
        print('Hello private world!')
    def call_private_method_in_class(self):
        self.__private_method()
my_instance = my_class()
my_instance.public_method()
my_instance._my_class__private_method()
my_instance.call_private_method_in_class()



List all Python Programs