Structures (abbreviated as "struct") are a simplified class that specializes in matching a structure from C. The syntax is similar.
Unions are allowed and can be used to create custom variant classes. Bit-fields are supported. However, if you don't need to communicate with C or assembler code, you should use classes instead of bit-fields or unions. This will let the compiler optimize storage better. The features here are for when the layout of the structure is already set in concrete and can't be changed.
Structures are always by-value. You can specify constructors, however a default constructor is implied. Structs can have methods. All structs derive from Object unless you specify a base type with the inherits clause. Structs can't have virtual methods, virtual properties, derive from classes other than Object, or implement interfaces.
structure MyStruct derives Object ' implicit, but shown here anyways to demonstrate the derives keyword. string member1 S$ = "3fs" constructor member1, S$ self.member1 = member1 self.S$ = S4 function override toString ' toString is overriding the base type returns string return member1 + " " + S$ var MyStruct name
Structures can have bitfields and unions. For more on bitfields, see bitfield and [Bitfields]. For more on unions, see union and [Unions].
Wiki: Bitfields
Wiki: Home
Wiki: Unions
Wiki: When is it a procedure, command, function, property, property accessor, method, complex statement, or type cast?
Wiki: keywords-bitfield
Wiki: keywords-extends
Wiki: keywords-structure
Wiki: keywords-union