Constructor Statement

Initializes the data of a new instance of an object.

Syntax

Usual construct

[ @Deprecated ] _
Constructor [ parameter_list ]
    [ statements ]
End [ Constructor ]

Var construct

[ @Deprecated ] _
Constructor { Dim | Var } parameter_list
    [ statements ]
End [ Constructor ]

Parts

@Deprecated
Optional modifier. See @Deprecated for more information.
Dim
Used with the “Var construct”. Specifies that variables declared in parameter_list are members of the parent construct. The arguments that you supply automatically assign values to the members. Such constructors must come before usual constructors.
Var
Same as Dim.
parameter_list
Optional in the usual construct. See Parameter List for more information.
Mandatory in the Var construct. The parameters become members of the parent construct. You can supply a default value with the operator «=».
statements
Optional statements.
End
Completes the statement. You can also use End Constructor.
You can change the syntax of this part. See @Option Directive for more information.

Instructions

ViviFire lets you have many constructors in an object. Each constructor must have a different parameter signature.

All constructors must be in a group together. They come after a possible data section and before a possible destructor or other procedures.

You can think of the data section as a type of constructor. Statements you put in this section run before Constructor.

Var construct

Constructors with the Var construct start with the line Constructor Var or Constructor Dim. Such constructors must have one or more parameters. Each parameter becomes a field of its parent object. You must put all such constructors before all of the usual constructors.

If you make an object with one or more constructors with the Var construct, ViviFire automatically calls all other such constructors with default values. You can specify different default values with parameter initializers. You do this with the operator = written between the parameter declarator and a constant value. Alternatively, you can use the statement Call Constructor.

Permitted parents

Changes in syntax with @Option

There are two areas where you can change the syntax of the statement:

See @Option Directive for more information.

Examples

TODO

See also