Each time a subclass is created, it inherits all of the data items and behaviors from the appropriate higher classes. It is critical to the understanding of inheritance to note that inheritance happens at different times during the life of an object. At object creation time, inheritance is the mechanism whereby the initial data structure for the object is created. Only data structures are inherited, never data . It is a common misconception that data is inherited, such that an order may inherit the data items for the customer that placed an order.
Inheritance is used only to create the initial, empty data structures for the object.
Not all classes within a generalization hierarchy will have objects associated with them. The object-oriented paradigm allows for abstraction, which means that a class may exist only for the purpose of passing inherited data and behaviors. Any instances of this class will inherit data and behaviors from both the CAR and the BOAT subclasses. In Figure 2, the entire class hierarchy describes vehicles associated with the ITEM entity in the overall database, and class hierarchies do not imply data relationships between the classes. Polymorphism Polymorphism is the ability of different objects to receive the same message and behave in different ways.