In an earlier chapter we introduced the principle of substitutability. This principle said that an instance of a child class should be able to be used where an instance of the parent class is expected. This is our idealized view of inheritance.
The abstract concept is captured by a pair of easy rules of thumb. These are called the is-a relation and the has-a relation.
To see if a concept should be structured as a subclass of another concept, form the English sentence ``an A is a B''. If it sounds right to your ear, then inheritance is probably called for. If it sounds wrong, then probably not. For example, a dog is a mammal sounds right, but a car is-a engine sounds wrong.