title: How abstraction and encapsulation differ?
body: <p>I am preparing for an interview and decided to brush up my OOP concepts.
  There are hundreds of articles available, but it seems each describes them differently.
  <a href="http://www.c-sharpcorner.com/UploadFile/eecabral/OOPSand.NET211102005075520AM/OOPSand.NET2.aspx" rel="noreferrer">Some</a> says</p>
  
  <blockquote>
    <p>Abstraction is "the process of identifying common patterns that have
    systematic variations; an abstraction represents the common pattern
    and provides a means for specifying which variation to use" (Richard
    Gabriel).</p>
  </blockquote>
  
  <p>and is achieved through abstract classes.</p>
  
  <p>Some <a href="http://forums.asp.net/t/1258933.aspx/1" rel="noreferrer">other</a> says</p>
  
  <blockquote>
    <p>Abstraction means to show only the necessary details to the client of
    the object</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>Let’s say you have a method "CalculateSalary" in your Employee class,
    which takes EmployeeId as parameter and returns the salary of the
    employee for the current month as an integer value. Now if someone
    wants to use that method. He does not need to care about how Employee
    object calculates the salary? An only thing he needs to be concern is
    name of the method, its input parameters and format of resulting
    member,</p>
  </blockquote>
  
  <p>I googled again and again and none of the results seem to give me a proper answer. 
  <strong>Now, where does encapsulation fit in all these?</strong>
  I searched and found a <a href="https://stackoverflow.com/questions/8960918/how-encapsulation-is-different-from-abstraction-as-a-object-oriented-concept-in">stack overflow question</a>. Even the answers to that questions were confusing
  <a href="https://stackoverflow.com/a/8960961/2401223">Here</a>, it says</p>
  
  <blockquote>
    <p>Encapsulation is a strategy used as part of abstraction. Encapsulation
    refers to the state of objects - objects encapsulate their state and
    hide it from the outside; outside users of the class interact with it
    through its methods, but cannot access the classes state directly. So
    the class abstracts away the implementation details related to its
    state.</p>
  </blockquote>
  
  <p>And <a href="https://stackoverflow.com/a/8961003/2401223">here</a> another reputed member says,</p>
  
  <blockquote>
    <p>They are different concepts.</p>
    
    <p>Abstraction is the process of refining away all the
    unneeded/unimportant attributes of an object and keep only the
    characteristics best suitable for your domain.</p>
  </blockquote>
  
  <p>Now I m messed up with the whole concept. I know about abstract class, inheritance, access specifiers and all. I just want to know <strong>how should I answer when I am asked about abstraction and/or encapsulation in an interview.</strong></p>
  
  <p><em>Please don't mark it as a duplicate</em>. I know there are several similar questions. But I want to avoid the confusion among the conflicting explanations. Can anyone suggest a credible link? A link to stackoverflow question is also welcome unless it creates confusion again. :)</p>
  
  <p><strong>EDIT: I need answers, a bit c# oriented</strong></p>