What is the difference between data encapsulation and data abstraction?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What is the difference between data encapsulation and data abstraction??

.

4th Feb 2018, 11:20 AM
Subha
Subha - avatar
2 Answers
+ 6
Abstraction is about hiding unwanted details while giving out most essential details, while Encapsulation means hiding the code and data into a single unit e.g. class or method to protect inner working of an object from outside world.
4th Feb 2018, 1:05 PM
Saminjay Goel
Saminjay Goel - avatar
+ 1
abstraction is thinking of a object irl and using it to create classes. encapsulation is using classes and methods to make variables secure and inaccesible from outside the class itself. essentially, embedding an attribute or behavior but it can only be accessed indirectly by the class and method being evoked from outside where the variable is declared.
7th Mar 2018, 4:34 AM
RK24