Method: Constructor Init()

Every class and class variant definition may implement its own constructor. Constructors are specialized methods, which are invoked automatically during the creation of new objects to complement and finalize their initialization. In Embedded Wizard, constructors are usual methods named explicitly with the identifier Init and declared without any return value and with unique parameter of type handle:

Declaration of a constructor method within the Code Editor window.

Unlike an ordinary method, constructors are invoked by the system only. Calling the Init() method directly from another method is not possible. Moreover, in derived classes when the constructor method is overridden, the system ensures automatically, that starting with the oldest ancestor class every constructor implementation is being called. The usage of the pseudo method super() is not necessary and even not possible.

Override inherited Init() method

Each class inherits the Init() method from its immediate ancestor class. In case of a class not descending from a concrete class, the Init() method is inherited from an internal class serving as very base ancestor for all Chora classes. In other words, each Chora class includes implicitly an Init() method. You see this inherited method in the Inspector window:

Inherited constructor within the Inspector window.

In order to implement this method:

Localize and override the Init method first.

Then open the method for editing in the Editor window.

Implement the Init() method

Init() methods are implemented similarly as you do with ordinary methods. The handle parameter aArg has under normal circumstances the value null and should be ignored.