title: What does it mean to "program to an interface"?
body: <p>I have seen this mentioned a few times and I am not clear on what it means. When and why would you do this? </p>
  
  <p>I know what interfaces do, but the fact I am not clear on this makes me think I am missing out on using them correctly. </p>
  
  <p>Is it just so if you were to do:</p>
  
  <pre><code>IInterface classRef = new ObjectWhatever()
  </code></pre>
  
  <p>You could use any class that implements <code>IInterface</code>? When would you need to do that? The only thing I can think of is if you have a method and you are unsure of what object will be passed except for it implementing <code>IInterface</code>. I cannot think how often you would need to do that. </p>
  
  <p>Also, how could you write a method that takes in an object that implements an interface? Is that possible?</p>