CLASS statement
CLASS statement - creating a new custom class.
Syntax
CLASS ABSTRACT name [caption] [imageSetting] [: parent1, ..., parentN];
CLASS [NATIVE] name [caption] [imageSetting]
[{
objectName1 [objectCaption1] [imageSetting],
...
objectNameM [objectCaptionM] [imageSetting]
}]
[: parent1, ..., parentN];
Where imageSetting is one of:
IMAGE [imageLiteral]
NOIMAGE
Description
The CLASS statement declares a new class and adds it to the current module.
The statement has two forms: CLASS ABSTRACT for declaring an abstract class and just CLASS for declaring a concrete class. In the latter case, during declaration, you can declare the static objects of this class and specify their names and captions in a curly brackets block.
The NATIVE keyword is used in some system modules. It is used to declare individual system classes that are created before the modules are initialized.
Parameters
-
nameClass name. Simple ID. The name must be unique within the current namespace.
-
captionClass caption. String literal. If the caption is not defined, the name of the class will be its caption.
-
imageSettingIcon setting for the class (when written after the class caption) or for a static object (when written after the object's caption). One of:
-
IMAGEManual icon specification, optionally followed by
imageLiteral— a string literal whose value defines the icon. IfimageLiteralis omitted, the automatic assignment mode is enabled. -
NOIMAGEThe class or static object has no icon.
-
-
objectName1, ..., objectNameMThe names of static objects of this class. Each name is defined by a simple ID. The name of each static object is available through the
name[StaticObject]property. -
objectCaption1, ..., objectCaptionMCaptions of static objects of this class. Each caption is a string literal. If the caption is not defined, the name of the static object will be its caption. The caption of each static object is available through the
caption[StaticObject]property. -
parent1, ..., parentNList of parent class names. Each name is defined by a composite ID. If the list of parent classes is not specified, the class is inherited from the
System.Objectclass.
Examples
CLASS ABSTRACT Document; // The caption of this class will be 'Document'
CLASS IncomeDocument 'Income' : Document;
CLASS OutcomeDocument 'Expenses' : Document;
CLASS Person;
CLASS Worker;
CLASS Musician : Person, Worker; // multiple inheritance
CLASS Barcode 'Barcode'; // The parent class of Barcode will be the System.Object class
CLASS PrintOrientation {
portrait 'Portrait',
landscape 'Landscape'
}
CLASS Currency 'Currency' IMAGE 'currency.png'; // a class with an icon