Operator MultiplyRight

From Xojo Documentation


Used to overload the * operator, providing custom functionality.


Create an Operator_Multiply function in a class to specify the functionality of the * operator for that class.

In the function, the Self instance is the operand on the right and the other operand is passed as a parameter.

The ordinary methods are always preferred; the Right version is used only if there is no legal left version.

Sample Code

Using the Vector class (see Operator_Add) with two Integer elements, x and y, we define an Operator_MultiplyRight function that multiplies the sum of the passed instance with the Self instance.

Function Operator_MultiplyRight(lhs As Vector) As Integer
Var a, b As Integer
a = Self.x + Self.y
b = lhs.x + lhs.y

Return b * a
End Function

See Also

* operator; Operator_Multiply function.