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.
In addition to subclasses and superclasses, PSL provides three other types of classes that are cornerstones of an object-oriented design:
Final classes - The properties and methods of a final class cannot be inherited by other classes. For example, if you define the XYZ class as final, you cannot create subclasses based on (i.e., inherited from) the XYZ class. The concept of Final Classes is not available in this PSL release.
Abstract classes - A superclass that declares the structure of a class without providing a complete implementation of every method. You may want to define a superclass that only defines a generic form that is shared by all its subclasses, yet enabling each subclass to specify the details. For example, the PSL Record class contains all the methods used by its subclasses RecordACN, RecordDEP, RecordLN, RecordCRCD, etc. You cannot create an instance of the Record class because it has no meaning. However, the Record class does contain the methods of all its subclasses.
Object classes - The superclass of all other PSL classes. Because every other class is a subset of the Object class, every other class inherits all the methods and properties accessible from the Object class.