Object Lifetime

An object (an instance of a class) is made with statements that use one of the keywords Dim, Var, or New. Frequently objects must do some tasks and/or have some initial state before they can be used. Examples of tasks are to open files and to connect to databases. ViviFire lets you control how new objects get initialized with special procedures known as constructors.

When an object goes out of scope, it gets erased by the runtime. ViviFire lets you control how objects are erased with special procedures known as destructors.

Using constructors and destructors

constructors and destructors control how objects are made and erased. Constructors start with the keyword Constructor. And destructors start with the keyword Destructor.

constructor procedures


destructor procedures


constructor and destructor procedures in a class hierarchy


Garbage Collection


See also