python hide details

Solutions on MaxInterview for python hide details by the best coders in the world

showing results for - "python hide details"
Lavinia
30 Mar 2019
1class MyClass:
2    __hiddenVar = 12
3    def add(self, increment):
4       self.__hiddenVar += increment
5       print (self.__hiddenVar)
6myObject = MyClass()
7myObject.add(3)
8myObject.add (8)
9print (myObject._MyClass__hiddenVar)