private and protected in python code example
Example 1: python protected attributes
class example:
def __init__(self):
self._variable1='protected variale'
self.__variable2='private variable'
self.variable3='public variable'
Example 2: python protected method
class example:
def __init__(self):
self._method1() #protected
self.__method3() #private
self.method3() #public