title: Favor composition over inheritance
body: <blockquote>
    <p>Favor composition over inheritance</p>
  </blockquote>
  
  <p>is very popular phrase. I read several articles and at the end each article says </p>
  
  <blockquote>
    <p>use inheritance when there is pure IS-A relationship between classes.</p>
  </blockquote>
  
  <p>An example from <a href="http://www.artima.com/designtechniques/compoinhP.html">this article</a>:</p>
  
  <p>Here between <strong>Apple</strong> and <strong>Fruit</strong> there is clear IS-A relationship i.e  Apple IS-A Fruit, yet the author has also shown it as Apple HAS-A Fruit (composition) to show the pitfall when implemented with inheritance.</p>
  
  <p>I became somewhat confused here that what is the meaning of statement</p>
  
  <blockquote>
    <p>use inheritance when there is pure IS-A relationship between classes.</p>
  </blockquote>
  
  <p>Does using composition over inheritance  mean that always <strong>try</strong> to apply  composition  <strong>even if</strong> there is a pure IS-A relationship and leave inheritance <strong>only for those cases where composition does not make sense</strong>?</p>