class function
Syntax
class ClassName [{extends | implements} SuperClassName]
[Method_declarations]
[Property_declarations]
[protected
[Method_declarations]
[Instance_declarations]
[Constant_declaration]]
[private
[Method_declarations]
[Instance_declarations]
[Constant_declaration]]
end-class
Where Method_declarations are of the form:
method methodname([MethodParam1 [, MethodParam2...] [Returns Datatype]] [abstract])
Where Property_declarations are of the form:
property DataType PropertyName {{[get] | [set]} | [abstract] | [readonly]}
Where Instance_declarations are of the form:
instance DataType &Variable1 [, &Variable2...]
Where Constant_declarations are of the form:
constant &Constant = {Number | String | True | False | Null }
Description
Use the Class language construct to build application classes in an application package. All classes within a package must be uniquely named, however, classes contained in different packages do not have to be named uniquely.
External function declarations are allowed in application classes, in the global and component variable declarations, after the class declaration (after the end-class statement), and before the method definitions.
Parameters
| Parameter | Description |
|---|---|
|
ClassName |
Specify the name of the class that you are creating. All classes within a package must be uniquely named, however, classes contained in different packages do not have to be named uniquely. |
|
extends | implements SuperClassName |
For a regular class, specify the name of the class that this class extends. If the class is an interface type of class, specify the name of the interface that this class implements. Important: You must import the class to extend it. |
|
Method_declarations |
Specify the methods (and their signature) as used in this class. |
|
Property_declarations |
Specify the properties, and their usage, in this class. |
|
protected |
Use this keyword to declare any methods, constants, or instance variables as protected to the class, that is, are only visible to the declaring class and subclasses. |
|
private |
Use this keyword to declare any methods, constants, or instance variables as private to the class, that is, they can't be accessed by any other classes. |
|
Instance_declarations |
Specify any variables that should be in any instance (object) of the class. |
|
Constant_declarations |
Specify any constants that should be used with this class. |
Returns
None.
Example
class Example extends ExampleBase
method NumToStr(&Num As number) Returns string;
method AppendSlash();
property number SlashCount get;
property number ImportantDayOfWeek get set;
property string SlashString readonly;
property date ImportantDate;
private
method NextDayOfWeek(&DoW As number) Returns date;
constant &Sunday = 1;
instance number &BaseString;
end-class;
Related Topics