1

I faced this question in an interview. I came back and read up about it here on SO and came across this, this and this, and many other duplicates saying almost the same thing.

I understand that the general definitions predate their implementations in programming languages. I also know that programming languages (I speak for Java) try to separate the two definitions as much as possible. For ex: Java considers class as encapsulation, as provides a wrapper to hold all your similar data; and interface is a kind of abstraction.

But what I really want to know is how do the two definitions overlap? Are the two subsets, overlapping, or completely disjoint sets. I understand that the definitions change wrt to generic definitions and language specific definitions, so answer both if you can, or atleast mention the one you're talking about.

leo
  • 1,423
  • 2
  • 14
  • 23
  • Does this answer your question? http://stackoverflow.com/a/22191855/126014 – Mark Seemann Sep 09 '15 at 19:33
  • That's a brilliant way to explain abstraction I must say, but the answer doesn't mention anything about encapsulation. – leo Sep 09 '15 at 19:50
  • I prefer Bertrand Meyer's definition of encapsulation, which I briefly describe here: http://stackoverflow.com/a/31133372/126014 You can also learn more about it in [my Pluralsight course on encapsulation (and SOLID)](http://bit.ly/encapsulationsolid). – Mark Seemann Sep 09 '15 at 19:53

0 Answers0