Encapsulation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Encapsulation

In what kind of situations does Encapsulation of method members really needed???

25th Jan 2017, 4:10 AM
Sai Vamsi
Sai Vamsi - avatar
1 Answer
+ 2
That depends with your program, lets take the example of a phone and lets use abstraction because it goes all together with encapsulation. You can make a phone call through a phone by pressing the call symbol and the call will go through but you won't be able to now of the background process because it was hidden from you. This is how encapsulation is used, you make present the relevant information and hide the irrelevant one, after all why make it present so some hacker can use it hack into your system because it will prove useful to him
25th Jan 2017, 3:07 PM
Tuchy
Tuchy - avatar