Skip to main content
Version: 4.x

Class extension

The class extension technique allows the developer to inherit one class from another after its creation. Also, using this mechanism you can add extra static objects to a class.

Class extension, together with the property and action extension technique, allows you to:

  • Extract the relations between classes into a separate module, thereby obtaining a more modular architecture.
  • Modify the functionality of an existing module without making any changes to it.
  • Declare classes in the metacode by defining the inheritance of a class outside its bounds.

Language

To extend a class, use the EXTEND CLASS statement.

Examples

CLASS ABSTRACT Shape;
CLASS Box : Shape;

CLASS Quadrilateral;
EXTEND CLASS Box : Quadrilateral; // Adding inheritance

CLASS ShapeType {
point 'Dot',
segment 'Line segment'
}

EXTEND CLASS ShapeType { // Adding a static object
circle 'Circle'
}