Why is Encapsulation really important? I get that it hides our data, it provides flexibility etc, but why is is so important? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is Encapsulation really important? I get that it hides our data, it provides flexibility etc, but why is is so important?

11th Oct 2019, 5:10 AM
Brandon Ngacho
Brandon Ngacho - avatar
2 Answers
+ 3
Encapsulation promotes maintenance. Code changes can be made independently.
11th Oct 2019, 5:22 AM
Swetha
Swetha - avatar
0
Could you please go in depth?? basically, why should we use getters ans setters instead of constructors when they can do the same thing?
11th Oct 2019, 5:29 AM
Brandon Ngacho
Brandon Ngacho - avatar