Revision [12400]
This is an old revision of KeyPgOpLet made by JeffMarshall on 2008-01-18 14:21:39.
Operator Let (Assign)
Indicates the assignment operator when overloading KeyPgOpAssignment Operator = (Assignement
Syntax:
{ KeyPgType Type | KeyPgClass Class | KeyPgUnion Union | KeyPgEnum Enum } typename
KeyPgDeclare declare KeyPgOperator operator Let ( [ KeyPgByref byref | KeyPgByval byval ] rhs KeyPgAs as DataType datatype )
End { KeyPgType Type | KeyPgClass Class | KeyPgUnion Union }
KeyPgOperator operator typename.Let ( [ KeyPgByref byref | KeyPgByval byval ] rhs KeyPgAs as DataType datatype )
Usage:
lhs = rhs
Parameters:
typename
lhs
lhs
The variable to assign to.
rhs
The value to assign.
Description:
Let is used to overload the KeyPgOpAssignment Operator = (Assignment) operator and to distinguish it from the comparison operator KeyPgOpEqual Operator = (Equal).
lhs = rhs will assign the rhs to lhs by invoking the Let operator procedure defined int typename.
Examples:
Type T
x As Integer
y As Integer
Declare Operator Let( ByRef rhs As T )
End Type
Operator T.Let( ByRef rhs As T )
x = rhs.x
y = rhs.y
End Operator
Dim a As T = ( 5, 7 )
Dim b As T
'' Do the assinment invoking the LET
'' operator procedure
b = a
Print "a.x = "; a.x
Print "a.y = "; a.y
Print
Print "b.x = "; b.x
Print "b.y = "; b.y
x As Integer
y As Integer
Declare Operator Let( ByRef rhs As T )
End Type
Operator T.Let( ByRef rhs As T )
x = rhs.x
y = rhs.y
End Operator
Dim a As T = ( 5, 7 )
Dim b As T
'' Do the assinment invoking the LET
'' operator procedure
b = a
Print "a.x = "; a.x
Print "a.y = "; a.y
Print "b.x = "; b.x
Print "b.y = "; b.y
Output:
a.x = 5 a.y = 7 b.x = 5 b.y = 7
Dialect Differences:
- In the CompilerOptlang -lang qb dialect, this operator cannot be overloaded.
- In the CompilerOptlang -lang qb dialect, an assignment expression can be preceded by the KeyPgLet Let keyword.
Differences from QB:
- None
See also:
- KeyPgLet Let
- KeyPgOpEqual Operator Let() (Assignment)
- KeyPgOpEqual Operator = (Assignment)
- KeyPgOpEqual Operator = (Equal)
Back to Assignment Operators
Back to Operators