Class hierarchy can be viewed one of two ways
Specialization (Top Down Approach)
Generalization (Bottom Up Approach)
Specialization is a process of identifying subsets of an entity that shares different characteristics. It breaks an entity into multiple entities from higher level (super class) to lower level (subclass).
The class vehicle can be specialized into Car, Truck and Motorcycle ( Top Down Approach)
Hence, vehicle is the superclass and Car, Truck, Motorcycle are subclasses. All three of these inherit attributes from vehicle. Moreover, these three share those attributes among themselves while containing some other attributes which make them different.
Generalization is a process of generalizing an entity which contains generalized attributes or properties of generalized entities. The entity that is created will contain the common features. Generalization is a Bottom up process.
The classes Car, Truck and motorcycle can be generalised into Vehicle. (Bottom Up Approach). Car, Truck and Motorcycle are subclasses while vehicle is the superclass.
Basically, Vehicle contains the common attributes that were shared between Car, Truck and Motorcycle.