+ 3

can anybody explain me wht exactly is encapsulation?? its a bit confusing ..

7th Jul 2016, 10:37 AM
Nidhi Jangir
Nidhi Jangir - avatar
2 odpowiedzi
+ 5
in real life, encapsulation is used to protect the data, so noone is unable to access or perhaps change the data. for example, if u hv bank account with $10.000 balance, but then somebody (hacker perhaps) changes your balance to $1.000 without withdraw action, you might bomb the bank the next day when u hv checked ur account. therefore, the encapsulation purpose is to secure ur data (balance) and it is accessible only by the object itself not the hacker. i wish this example may help u to understand what is encapsulation in simple way
11th Jul 2016, 1:39 PM
christie
+ 1
Encapsulation is what you do when creating classes. You say that some members are private, some protected and others public. When you do that, you are encapsulating the members within a class. You are telling the access specifiers of each of the members, which is called, you guessed it, encapsulation.
7th Jul 2016, 1:29 PM
Garme Kain
Garme Kain - avatar