Constructor Statement

Initializes the data of a new instance of an object.


Usual construct

Constructor [ parameter_list ]
    [ statements ]
End [ Constructor ]

Var construct

Constructor { Dim | Var }
End [ Constructor ]


Used with the “Var construct”. Specifies that variables declared in statements are (1) parameters and (2) members of the parent construct. The arguments that you supply automatically assign values to the members. Such a constructor must come before usual constructors.
Same as Dim.
Optional in the usual construct. See Parameter List for more information.
Not permitted in the Var construct.
Optional in the usual construct – Executable statements.
Mandatory in the Var construct – One or more variable declaration statements.
Completes the statement. You can also use End Constructor.
You can change the syntax of this part. See @Option Directive for more information.


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 execute before Constructor.

Var construct

Constructors with the Var construct start with the line Constructor Var or Constructor Dim. Such constructors can contain only variable declaration statements. Each variable declaration also becomes a parameter to the constructor. You must put all such constructors before all of the usual constructors.

If you make a class with one or more constructors with the Var construct, then you must call all of them from all other constructors. You 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.



See also