Search This Blog

Friday, June 15, 2018

Encapsulation Vs Abstraction



Encapsulation
Abstraction
Hide data members and member functions within entity (called class) from outside
Show only relevant data and hide the irrelevant data within the scope
Hide information
Hide Implementation
Protection Purpose
Complexity Reduction Purpose
Achieve using access modifiers
Achieve using interface and/or abstract classes
Implement on implementation level
Implement on design level

Encapsulation: Hide data members and member functions within entity/unit (called class) from outside the world, for hiding information in the purpose of protecting data on implementation level and this hide information is achieved through access modifiers.

Abstraction: Display only relevant information and hide the irrelevant data. E.g. only declaration of the method without implementation. So that it can be known that what are the methods within the class but how they will work is not known and by this way it reduces the complexity of the code. This is achieve using interface and/or abstract classes on design level.

No comments:

Post a Comment


This is a User Friendly Blog.
Simple Interface and Simple Controls are used.
Post your comments so i can modify blog regarding your wish.