class Padre:
def __init__(self):
self.__private = 0
self._protected = 1
self.public = 2
def get_private_attribb(self):
return self.__private
def set_private_attribb(self, value):
self.__private = value
class Hija(Padre):
def printAll(self):
print (self.public)
print (self._protected)
print (self.__private)
class Primo():
def printAll(self):
print(Padre().public)
print(Padre()._protected) # Podrá accederse
print(Padre().__private)
h = Hija()
#h.printAll()
#pri = Primo()
#pri.printAll()
To embed this project on your website, copy the following code and paste it into your website's HTML: