Operator Let (Assign)
 
Indicates the assignment operator when overloading Operator = (Assignment)

Syntax

{ Type | Class | Union | Enum } typename
Declare Operator Let ( [ ByRef | ByVal ] rhs As datatype )
End { Type | Class | Union }

Operator typename.Let ( [ ByRef | ByVal ] rhs As datatype )

Usage

lhs = rhs

Parameters

typename
name of the Type, Class, Union, or Enum
lhs
The variable to assign to.
rhs
The value to assign.

Description

Let is used to overload the Operator = (Assignment) operator and to distinguish it from the comparison operator Operator = (Equal).

lhs = rhs will assign the rhs to lhs by invoking the Let operator procedure defined int typename.

Example

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

Output:
a.x =  5
a.y =  7

b.x =  5
b.y =  7

Dialect Differences

Differences from QB

  • None

See also