What is the difference between encapsulation and information hiding in object oriented programming ????? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

What is the difference between encapsulation and information hiding in object oriented programming ?????

19th Mar 2019, 10:38 AM
Nithya Yamasinghe
Nithya Yamasinghe - avatar
4 Answers
+ 12
I always thought that data hiding was one aspect of encapsulation while the other is keeping fields and functions together.
19th Mar 2019, 10:29 PM
Sonic
Sonic - avatar
+ 9
What I can understand is, encapsulation is about keeping related data together or say bundling the data. Like, a class can have methods for particular job. And data hiding is way to hide data from other parts of the program. Like, by using private keyword in Java, we can hide data from being accessible by other part of the program. Encapsulation is also in a way can be used for data hiding.
19th Mar 2019, 11:18 AM
Шащи Ранжан
Шащи Ранжан - avatar
0
The main difference between data hiding and encapsulation is that data hiding focus more on data security and encapsulation focuses more on hiding the complexity of the system.
12th Apr 2019, 6:21 PM
SKY
SKY - avatar
0
I think encapsulation is for multiple use and hiding is to make the usage either private or never open for use at all
11th May 2019, 8:11 PM
JAMES ADAKOLE
JAMES ADAKOLE - avatar