Home / lang / createstatic 
CREATE STATIC
Syntax
CREATE STATIC

These keywords, when placed alone at the beginning of a class file, tells the interpreter that when applying non-static symbols to the name of the class, an automatic hidden instance of it will be created on the fly.

If you use this feature, the class constructor (the special method _new) will be called with no parameters.

This feature is already used internally by the Form and the Settings classes.

Are you superstitious ? Here are the first 13 lines of the Settings class code:

Example
' Gambas class file
EXPORT
CREATE STATIC

PRIVATE $sPath AS String
PRIVATE $sTitle AS String
PRIVATE $cSlot AS NEW Collection
PRIVATE $bModify AS Boolean

PUBLIC SUB _new(OPTIONAL Path AS String, OPTIONAL Title AS String)

  DIM hFile AS File
  DIM sLine AS String
...


See also
Object & Class Management  CREATE PRIVATE