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. A class whose descent from System.StaticObject comes only from the static objects added this way has it only when the extending module is loaded: in a project that does not include that module the class has no static objects, is not a System.StaticObject, and the properties of static objects (caption[StaticObject] and the others) applied to its objects are not found. So a module that applies these properties to such a class depends on the module that adds the static objects, not only on the module that declares the 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'
}