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

what is the difference between encapsulation and abstraction?

26th Sep 2016, 5:36 PM
Pratik Shetty
Pratik Shetty - avatar
5 Answers
+ 6
Encapsulation is wrapping data and functionality(methods accessing data) together thus hiding data from user. Abstraction is to hide implementation details from user. Abstraction is more about what object can do rather than how it does it..
12th Oct 2016, 7:57 PM
Piyush Marda
Piyush Marda - avatar
+ 2
...What is the common point between them? Encapsulation is about hiding the implementation from the outside, abstraction is about reducing something to the properties we are interested in.
26th Sep 2016, 8:05 PM
Zen
Zen - avatar
+ 2
Abstraction is showing the relevant data only.. And encapsulation is hiding the data..
6th Oct 2016, 8:21 AM
Saharsh Pandey
Saharsh Pandey - avatar
+ 2
Abstraction is hiding implementation details(of a method) n is generally done using abstract classes and interfaces while encapsulation is hiding data (data members) using access modifiers like private and protected.
14th Oct 2016, 9:30 PM
Piyush Bhatt
Piyush Bhatt - avatar
0
So the abstraction is showing the minimum required relevant data. but the encapsulation is hiding the data from the outside.
12th Oct 2016, 7:47 PM
Mohammad Ali Barham
Mohammad Ali Barham - avatar