Possible Duplicate:
difference between abstraction and encapsulation?
What is the difference between abstraction and encapsulation?
I've noticed that the notion of Encapsulation and Abstraction are important when discussing OOP design. However, I'm not too sure on how they differ from one another. I've read a bunch of articles and posts (of which most of them are from this site) which merely contradict each other.
It's my understanding that Abstraction is a means of decomposing the complexity of real-world objects. This decomposition may involve the creation of several objects that collectively represent a real-world object. Abstraction can also have many layers to it, class inheritance is an example of when this would be the case.
Encapsulation is the process of hiding away the inner implementation data within a class. Language features such as Access modifiers and Accessor methods are key in this.
If these definitions are true (correct me if I'm wrong), under what principle would Interfaces be used for? Abstraction? because a group of real-world objects can be summarized in an interface? Or Encapsulation, where the Interface itself can be used to expose the features of an object without revealing the inner functionality.
If possible could you also provide an brief example, that will clearly distinguish these two principles?
Cheers.