Inclusion

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > Data types and variables > TYPE (or UDT User Defined Types) > UDT (User Defined Types) > Extending existing UDT >

Inclusion

 

Inclusion

 

Sometimes you wish to re-use the elements of existing type, but you need them at specific location.

 

Using the inclusion mechanism, you can specify where will the element be included.

 

In our case, creating Point3D would be as done as:

 

TYPE Point3D
  Point2D
  z AS SINGLE
END TYPE

 

In this case, x and y will be placed before z in the UDT memory.

 

Should you need to have them after z, just put the included type on different place:

 

TYPE Point3D
  z AS SINGLE
  Point2D  
END TYPE

 

Now z goes first, and x and y follow.