Operator + (Addition)
Sums two expressions
Declare Operator + ( ByRef lhs As Integer, ByRef rhs As Integer ) As Integer
Declare Operator + ( ByRef lhs As UInteger, ByRef rhs As UInteger ) As UInteger
Declare Operator + ( ByRef lhs As LongInt, ByRef rhs As LongInt ) As LongInt
Declare Operator + ( ByRef lhs As ULongInt, ByRef rhs As ULongInt ) As ULongInt
Declare Operator + ( ByRef lhs As Single, ByRef rhs As Single ) As Single
Declare Operator + ( ByRef lhs As Double, ByRef rhs As Double ) As Double
Declare Operator + ( ByRef lhs As T Pointer, ByRef rhs As Integer ) As T Pointer
Declare Operator + ( ByRef rhs As Integer, ByRef lhs As T Pointer ) As T Pointer
Declare Operator + ( ByRef lhs As T, ByRef rhs As Integer ) As T
Declare Operator + ( ByRef lhs As Integer, ByRef rhs As T ) As T
result = lhs + rhs
lhs
Returns the sum of two expressions.
When the left and right-hand side expressions are numeric values, Operator + (Add) returns the sum of the two values.
When the left and right-hand side expressions are string values, Operator + (Add) concatenates the two strings and returns the result.
If an integral value n is added to a T Pointer type, the operator performs pointer arithmetic on the address, returning the memory position of a T value, n indices away (assuming n is within bounds of a contiguous array of T values). This behaves differently from numeric addition, because the Integer value is scaled by SizeOf( T ).
Neither operand is modified in any way.
This operator can be overloaded to accept user-defined types.
will produce the output:
Syntax
Declare Operator + ( ByRef lhs As Integer, ByRef rhs As Integer ) As Integer
Declare Operator + ( ByRef lhs As UInteger, ByRef rhs As UInteger ) As UInteger
Declare Operator + ( ByRef lhs As LongInt, ByRef rhs As LongInt ) As LongInt
Declare Operator + ( ByRef lhs As ULongInt, ByRef rhs As ULongInt ) As ULongInt
Declare Operator + ( ByRef lhs As Single, ByRef rhs As Single ) As Single
Declare Operator + ( ByRef lhs As Double, ByRef rhs As Double ) As Double
Declare Operator + ( ByRef lhs As T Pointer, ByRef rhs As Integer ) As T Pointer
Declare Operator + ( ByRef rhs As Integer, ByRef lhs As T Pointer ) As T Pointer
Declare Operator + ( ByRef lhs As T, ByRef rhs As Integer ) As T
Declare Operator + ( ByRef lhs As Integer, ByRef rhs As T ) As T
Usage
result = lhs + rhs
Parameters
lhs
The left-hand side expression to sum.
rhsThe right-hand side expression to sum.
TAny pointer type.
Return Value
Returns the sum of two expressions.
Description
When the left and right-hand side expressions are numeric values, Operator + (Add) returns the sum of the two values.
When the left and right-hand side expressions are string values, Operator + (Add) concatenates the two strings and returns the result.
If an integral value n is added to a T Pointer type, the operator performs pointer arithmetic on the address, returning the memory position of a T value, n indices away (assuming n is within bounds of a contiguous array of T values). This behaves differently from numeric addition, because the Integer value is scaled by SizeOf( T ).
Neither operand is modified in any way.
This operator can be overloaded to accept user-defined types.
Example
Dim n As Single
n = 4.75 + 5.25
Print n
n = 4.75 + 5.25
Print n
will produce the output:
10
Dialect Differences
- In the -lang qb dialect, this operator cannot be overloaded.
Differences from QB
- None
See also