+ 1
What is the real point of encapsulation?
Whats the point of hiding members from outside of class if other programmers can edit that class, with only changing private to public members? And end-users can only access the interface. Even without encapsulation, they can't access/alter public variables if there's no way to do it.
4 Respuestas
+ 11
Encapsulation is defined as the wrapping up of data under a single unit. It is the mechanism that binds together code and the data it manipulates.Other way to think about encapsulation is, it is a protective shield that prevents the data from being accessed by the code outside this shield.
Technically in encapsulation, the variables or data of a class is hidden from any other class and can be accessed only through any member function of own class in which they are declared.As in encapsulation, the data in a class is hidden from other classes, so it is also known as data-hiding.
0
Encapsulation will ensure that there's no misuse or interference of data. More so the data you wouldn't like to be modified externally.
0
I mean what's the point of hiding it from other classes? Or to anything? The modifiers can be edited.
0
Okay well the explanation about IDE's are great!
So it's safe to say that encapsulation has nothing to do with the end-users.