Xbasic

Classes

Description

Alpha Anywhere allows users to create their own classes. The class creation syntax is as follows.

DEFINE CLASS ClassName
    ' dim local variables
    ' assign values to variables
    ' define functions
END CLASS

To instantiate a class you would use the following syntax.

DIM VariableName as {ClassName}

To use a class method you would use the following syntax.

Result = VariableName.FunctionName( [ Arguments ] )

A more complete example follows.

dim class global FavoriteDatabase
    dim private IntProductName as C
    function Show as V ()
        ui_msg_box("", productname)
    end function
    function productName.get()
        productname.get = upper(IntProductName)
    end function
    function productName.set(name as C)
        productname = name
        IntProductName = productname
    end function
end class

See Also