Can Anyone tell the exact difference between Data hiding and Encapsulation ? Not links to stackoverflow or quora. thanks in advn | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can Anyone tell the exact difference between Data hiding and Encapsulation ? Not links to stackoverflow or quora. thanks in advn

3rd May 2018, 6:30 PM
Ansari
Ansari - avatar
2 Answers
+ 3
Encapsulation and data hiding can in many definitions be an interchangeable concept, but consider this: A variable/field/method can be public, default, protected or private thanks to encapsulation, a public method was encapsulated as well as a private one, but data hiding is a "conceptualized technique" used in programming to avoid the modification of a variable/field/method in a direct way. Setters and getters are good examples of encapsulated data hiding. Hope this helps Ansari.
3rd May 2018, 7:21 PM
Roberto Guisarre
Roberto Guisarre - avatar
+ 1
much better 😊😊
3rd May 2018, 7:56 PM
Ansari
Ansari - avatar