|Abstraction || Encapsulation |
|Abstraction solves the problem in the design level.
||Encapsulation solves the problem in the implementation level. |
|Abstraction is used for hiding the unwanted data and giving only
relevant data. ||Encapsulation is hiding the code and data into a single unit to
protect the data from outer world. |
|Abstraction is set focus on the object instead of how it does it. ||Encapsulation means hiding the internal details or mechanics of how
an object does something. |
|Abstraction is outer layout in terms of design. |
For Example: - Outer Look of a iPhone, like it has a display screen.
|Encapsulation is inner layout in terms of implementation. |
For Example: - Inner Implementation detail of a iPhone, how Display
Screen are connect with each other using circuits