Revision [13717]
This is an old revision of KeyPgOpLet made by CountingPine on 2008-09-11 12:43:58.
Operator Let (Assign)
Indicates the assignment operator when overloading KeyPgOpAssignment Operator = (Assignment)
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 assignment 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 assignment 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 and CompilerOptlang -lang fblite dialects, this operator cannot be overloaded.
- In the CompilerOptlang -lang qb and CompilerOptlang -lang fblite dialects, an assignment expression can be preceded by the KeyPgLet Let keyword.
Differences from QB:
- None
See also:
- KeyPgLet Let
- KeyPgOpLetlist Operator Let() (Assignment)
- KeyPgOpAssignment Operator = (Assignment)
- KeyPgOpEqual Operator = (Equal)
Back to Assignment Operators
Back to Operators