Encapsulation has two faces; data abstraction and information hiding. Data abstraction is a type seen from the outside. Information hiding is a type seen from the inside.
Sometime encapsulation is used to mean information hiding only but I think the definition I gave is better because if you encapsulate something you get both an inside and an outside right.
————— In Short —————-
Abstraction focuses on the outside view of an object (i.e. the interface)Encapsulation (information hiding) prevents clients from seeing its inside view, where the behavior of the abstraction is implemented.
There are 100s of postings and forums just confusing the two concepts. I think what Giri is posted is short and sweet.
HI GIRI,
WHAT YOU TOLD IS RIGHT, ITS SWEET SIMPLE AND APT DEFINITION DESCRIBING THE ACTUAL DIFFERENCE BETWEEN THE TWO MOST CONFUSING SUBJECTS.
Best and to the point
thanks a ton. i had to submit my assignment tommorow!!@!
The concept is still not clear. Hope you can elaborate this matter.