+ 6
Whats the key difference btwn Data encapsulation and Data abstraction ?
I had an interview today @ williamslea and had the above question.I gave a detailed explanation bt he was not convinced. myself too felt so confused abt dat! I go through different sites bt not get what i want. Can u people help me plz!
10 Answers
+ 7
@BenjiSolo Yah..i think abstraction s more generic term dan encapsulation. Encapsulation s jzt a part f abstraction.
+ 6
Thankuđč@BenjiSolo @Kalyan Kondapalli @ Hassam Usmani
+ 5
@BenjiSolo In that discussion n stackoverflow i saw a phrase "Abstraction is just opposite of Encapsulation", can u explain it more clearly?
+ 5
"The essence of abstraction is to extract essential properties while omitting inessential details"-"In encapsulation the data and its code are put together in a package or capsule."- Is this they meant by opposite functionality?
+ 2
any other ans.!?
+ 2
take a look there
https://www.sololearn.com/discuss/252198/?ref=app
+ 2
stackoverflow is the best site different types of codes and examples...u can search there....it very helpful
+ 2
Hi @RozeS. I saw it also. but I start saying that, has i understand things, encapsulation is a part of abstraction, so it can't be opposite, but instead complementaries..
However, if i try to understand what the guy said,
since Abstraction consist of showing details(methods, variables..) usefull for the creation and the manipulation of objects,
and then by encapsulating objects, we're effectively hiding those details of their implementations that are not really necessary for every body to know(for them not to be modified by any other unwanted user), we can see this as if both are opposite.
Finally Encapsulation is the medium used to choose wich thing is better to be hidden,and wich one can be visible, for the Abstraction to be realised.