231. How Private Variables Work in Python in Python with Code || Private Variable, Public Variable

Publicado em: 11 Novembro 2022
no canal de: Bhavatavi
2
0

Code:
class Person(object):
def __init__(self,name):
self.name=name
self.__education='Engineering'

def displayInfo(self):
name=self.name
education=self.__education
print("My name is",name,"and I have completed my",education)

if __name__=='__main__':
myObj=Person("Utara")
myObj.displayInfo()
print(myObj.name)
print(myObj.__education)
print(myObj._Person__education)


Nesta página do site você pode assistir ao vídeo on-line 231. How Private Variables Work in Python in Python with Code || Private Variable, Public Variable duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Bhavatavi 11 Novembro 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 2 vezes e gostou 0 espectadores. Boa visualização!