Zum Hauptinhalt springen
YouTube Security VideosGoogle Chrome: Unfinished Projects: New York City(06.10.2026 um 18:04 Uhr)
•
YouTube Security VideosSamsung Galaxy S26 FE im Test-Fazit: Warten = SPAREN! | CHIP(06.10.2026 um 18:15 Uhr)
••
YouTube Security VideosLinus Tech Tips: The All COSTCO Gaming Setup(06.10.2026 um 19:00 Uhr)
•
YouTube Security VideosGoogle Cloud Tech: Coding for 40 tokens/sec on a Pixel 10 📱(06.10.2026 um 18:00 Uhr)
••
YouTube Security VideosFlutter: Guard Clauses (Technique of the Week)(06.10.2026 um 18:00 Uhr)
••
YouTube Security VideosChrome for Developers: Modern Web Guidance: Autofill address form(06.10.2026 um 18:25 Uhr)
••
YouTube Security VideosGoogle Chrome: Unfinished Projects: New York City(06.10.2026 um 18:04 Uhr)
•
YouTube Security VideosSamsung Galaxy S26 FE im Test-Fazit: Warten = SPAREN! | CHIP(06.10.2026 um 18:15 Uhr)
••
YouTube Security VideosLinus Tech Tips: The All COSTCO Gaming Setup(06.10.2026 um 19:00 Uhr)
•
YouTube Security VideosGoogle Cloud Tech: Coding for 40 tokens/sec on a Pixel 10 📱(06.10.2026 um 18:00 Uhr)
••
YouTube Security VideosFlutter: Guard Clauses (Technique of the Week)(06.10.2026 um 18:00 Uhr)
••
YouTube Security VideosChrome for Developers: Modern Web Guidance: Autofill address form(06.10.2026 um 18:25 Uhr)
••
Intelligence View
⚡ tsecurity.de Intelligence

Encapsulation in Python

encapsulation is a method of wrapping data and functions into a single entity.Acts as a protective layer which means internal representation of an object is…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

encapsulation is a method of wrapping data and functions into a single entity.Acts as a protective layer which means internal representation of an object is generally hidden from outside of the object's definition.




class Employee:
def __init__(self,name,salary):
#private
self.name = name
#private member
# not accessible outside of a class
self.__salary = salary

def show(self):
print("Name is", self.name, "and salary is", self.__salary)


emp = Employee("Jessa", 10000)
emp.show()

# access salary from outside of a class

print(emp.__salary)






output




Name is Jessa and salary is 10000
AttributeError: 'Employee' object has no attribute '__salary'


Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Encapsulation in Python

Thematisch verwandte Begriffe: Encapsulation, Python · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
Nächster Beitrag