Skip to content

Struct Variables

A struct type is instantiated just like any other DataFlex type.

tUSAddress myAddress

The above creates a variable named myAddress of the struct type tUSAddress.

Struct types can also be used as parameter and function return types as well as properties. For example:

Class cMyButton is a Button
    Procedure Construct_Object
        Forward Send Construct_Object
    End_Procedure

    Property tUSAddress pCurrentAddress

    Procedure SaveAddress tUSAddress myBillingAddress
        //...
    End_Procedure

    Function CreateAddress Returns tUSAddress
        tUSAddress myAddress
        //...
        Function_Return myAddress
    End_Function

    Function TransformAddresses tUSAddress[] addresses Returns tUSAddress[]
        tUSAddress[] returnAddresses
        //...
        Function_Return returnAddresses
    End_Function
End_Class

Member Access

Members of a struct variable are accessed using the member access operator (the dot operator).

Integer iZipCode
Move "Miami Beach" to myAddress.sCity
Move myAddress.iZipCode to iZipCode

Note

For more information about structs, refer to the Struct command.

See Also