The simple rule is this:If an object has an is-a relationship to another object,use public inheritance.If a has-a relationship describes the objects best,then use layering. What exactly do the term is-a and has -a mean?Pretty much exactly what they sound like.If we use them in a sentence,the meaning becomes clearer:
Class covette is -a type of class Car.
Class Corvette has-a type class Radio.