Operator_Multiply

From Xojo Documentation

Revision as of 08:12, 22 August 2021 by RobinLM (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Global Method

Operator_Multiply(rightHandSide As Type)

Supported for all project types and targets.

Used to overload the * operator, providing custom functionality.


Global Method

Operator_Multiply() As Type

Supported for all project types and targets.

Used to overload the * operator, providing custom functionality.

Notes

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 left operand and the other operand is passed as a parameter.

Sample Code

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

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

Return a * b
End Function

See Also

* operator; Operator_MultiplyRight function.