Where is encapsulation useful? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 3

Where is encapsulation useful?

Is it the same in JavaScript and other languages?

28th Nov 2021, 2:25 PM
Fariborz
Fariborz - avatar
2 ответов
+ 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
Ipang
+ 2
Yes, I believe setters and getters and also proxies are encapsulation implementions.
28th Nov 2021, 3:20 PM
Mehran
Mehran - avatar