Improper inheritance is a very common design error. This seems to be because developers base inheritance relationships on their intuition rather than the objective criteria of substitutability. The following inheritance relationships are improper because the derived class
either requires more or promises less.
- A Stack is not a kind-of List (assuming List provides member functions that allow insertions in the middle of the list and Stack does not).
- A ListOfApples is not a kind-of ListOfFruit (assuming that any type of Fruit can be put into a ListOfFruit).
The following inheritance relationships may or may not be proper inheritance
depending on the specified behavior of the base class and the derived class.
- A Circle may not be a kind-of Ellipse.
- An Ostrich may not be a kind-of Bird.
- An Integer may not be a kind-of RationalNumber.