Extending a Subclass

Use

Changes to subclasses are cumulative, that is, you cannot delete a component from a class if it was inherited from a superclass. You can extend a subclass as follows:

  • By adding new components
  • By redefining inherited methods

Procedure

Adding New Components

You can define new components in all three visibility sections (public, protected, and private) of a subclass. Since both inherited and new components belong to the same namespace, you must ensure that all components in the class have unique names. For more information, see Creating Methods and Creating Events.

Redefining Methods

To redefine an inherited method in a subclass:

  1. Display all the methods of the subclass.

    The system displays the inherited methods of all subclasses.

  2. Place the cursor on the relevant method and switch to change mode.
  3. Choose Redefine.

    The source code of the original method implementation appears.

  4. Implement the method again.
  5. Check the syntax.
  6. Save your source code.
  7. Document the newly implemented method.

Result

You have extended the class and your new components are visible, as well as the public and protected components of the superclass. If you redefine a method in a subclass, the corresponding original method in the superclass remains unchanged.

You can access all the components that are visible in the subclass in the same manner. You also access the inherited components from the superclass with their local names. If you need to address components of the direct superclass, you can use the pseudo reference SUPER.