Click or drag to resize

IVarPut Function

X#
Assign a value to an exported instance variable.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION IVarPut(
	oObject AS Object,
	symInstanceVar AS STRING,
	uValue AS USUAL
) AS USUAL
Request Example 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#
1CLASS GetVars
2    EXPORT cName
3    INSTANCE cPhone
4FUNCTION Start()
5    LOCAL oVars AS OBJECT
6    oVars := GetVars{}
7    ? IVarPut(oVars, #cName, "VO")        // VO
See Also