ProAnswers.org

What is difference between encapsulation and abstraction?

1 Like

Encapsulation and abstraction both solve same problem: Complexity; but in different dimensions.

Abstraction: Hides the implementation details of your methods. Provides a base to variations in the application which can grow over a period of time.

Encapsulation: Hides the private data elements of the class and exposes only the required things to the clients.

Both are powerful; but using abstraction require more skills than encapsulation and bigger applications/products can not survive with out abstraction.