Skip Headers

# Inheritance

Previous

Next

Object-oriented systems allow classes to be defined in terms of other classes. For example: motorcycles, sedans, and vans are all kinds of vehicles. Each of the vehicle types is a subclass of the `Vehicle` class. Similarly, the `Vehicle` class is the superclass of each specific vehicle type. Each subclass inherits attributes and methods from its superclass (in addition to having its own attributes and methods).

Inheritance provides several application benefits, including the following:

- Using subclasses to provide specialized behaviors from the basis of common elements provided by the superclass. By using inheritance, you can reuse the code in the superclass many times.

- Implementing abstract superclasses that define generic behaviors. This abstract superclass may define and partially implement behavior, while allowing you to complete the details with specialized subclasses.

Refer to "Configuring Inheritance for a Child (Branch or Leaf) Class Descriptor" and "Configuring Inherited Attribute Mapping in a Subclass" for detailed information on using inheritance with TopLink.