Inheritance

Inheritance is a way of organizing related classes so that they can share common code. Inheritance facilitates the creation of hierarchical classifications. That is, you can create a class (i.e., the subclass) by having it inherit all the properties of any existing class definition (i.e., the superclass). For example, the deposit record class (RecordDEP) and loan record class (RecordLN) inherit their attributes from the account superclass (RecordACN). You can then add properties and methods as needed to the new class, as well as modify attributes of the superclass plus any that you add to it.

When you create a subclass of another class, the subclass inherits all the public fields of its superclass. A class can have any number of subclasses. However, a class can only have one immediate superclass. A subclass can, in turn, be a superclass of another subclass.

image\cam.gif

Inheritance

In addition to subclasses and superclasses, PSL provides three other types of classes that are cornerstones of an object-oriented design: