Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

_create

 

The optional _create function has following properties:

1.is automatically called once the variable is defined

2.it should never be called explicitly

3.it can take parameters, which can be used for initialization

 

For our case of Point2D it allows us to set x and y during the variable creation.

 

TYPE Point2D
  x AS SINGLE
  y AS SINGLE
  
  FUNCTION _create(x AS SINGLE, y AS SINGLE)
    ME.x = x
    ME.y = y
  END FUNCTION

 
END TYPE
 
DIM point AS Point2D(1, 2)

 

Now x contains 1 and y is equal to 2.

 

As you can see, the _create function is not explicitely called, but any parameters passed to your UDT upon creation are passed to _create automatically.

 

Without _create, you would need to initialize the variable the hard way:

 

DIM point AS Point2D
point.x = 1
point.y = 2

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software