Where is encapsulation useful? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Where is encapsulation useful?

Is it the same in JavaScript and other languages?

28th Nov 2021, 2:25 PM
Fariborz - avatar
2 Answers
+ 4
I think it's just as useful in any language with OOP paradigm. The point of encapsulation is to rather hide the complexity in classes and allow the outsiders to make use of the class without having concerns about what complexity lies behind the simplicity being offered. Not really sure that's what you meant to ask though ...
28th Nov 2021, 3:10 PM
+ 2
Yes, I believe setters and getters and also proxies are encapsulation implementions.
28th Nov 2021, 3:20 PM
Mehran - avatar