Showing posts with label Abstraction v/s Encapsulation. Show all posts
Showing posts with label Abstraction v/s Encapsulation. Show all posts

Thursday, May 26, 2011

What is the difference between abstraction and encapsulation?

Abstraction:
Abstraction lets you focus on what the object does instead of how it does it

That means we use the object without knowing the source code of the class.

Encapsulation:
Encapsulation means hiding the internal details or mechanics of how an object does something.

Encapsulation is wraping data into single unit.