Click or drag to resize

IVarPut Function

Assign a value to an exported instance variable.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax
 FUNCTION IVarPut(
	oObject AS Object,
	symInstanceVar AS STRING,
	uValue AS USUAL
) AS USUAL
View Source

Parameters

oObject
Type: Object
The object containing the exported instance variable.
symInstanceVar
Type: String
The exported instance variable to assign a value to.
uValue
Type: Usual
The value to assign to the exported instance variable.

Return Value

Type: Usual
The value assigned to <symInstanceVar> (<uValue>).
Remarks
Instead of modifying an instance variable through the := or = operators, IVarPut() provides a way to practice encapsulated object-oriented programming by safeguarding against accidental modification to an instance variable.
Examples
This example uses IVarPut() to assign a value to an exported instance variable.
X#
CLASS GetVars
        EXPORT cName
        INSTANCE cPhone
FUNCTION Start()
        LOCAL oVars AS OBJECT
        oVars := GetVars{}
        ? IVarPut(oVars, #cName, "VO")                // VO
See Also