This is the one of the main principle from oop's concept.it's hiding the the data and keep synonymous. It is internal representation of an object can't be seen from outside of the object definition.
__(underscore) : representation for hiding data.
Private date_A
instance_name._classname_A
Special methods use by Encapsulation :
1- Getters : gets()
2- Setters : set()
in C++ its called Public key
,in Java Private key ,in Python Protected Keywords.
Pseudo code:
Class Encapsulation (object): def__init__(self,a,b,c):
self.public=a;
self.protected=b;
self.private=c;
Happy Coding :)
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Encapsulation :
This is the one of the main principle from oop's concept.it's hiding the the data and keep synonymous. It is internal representation of an object can't be seen from outside of the object definition.
__(underscore) : representation for hiding data.
Special methods use by Encapsulation :
1- Getters : gets()
2- Setters : set()
in C++ its called Public key ,in Java Private key ,in Python Protected Keywords.
Pseudo code:
Happy Coding :)