Operator PowerRight

From Xojo Documentation

Method

Used to overload the ^ operator, providing custom functionality.

Notes

Create an Operator_PowerRight function in a class to specify the functionality of the ^ operator for that class when the Self instance is on the right.

In the function, the other operand is passed as a parameter and is raised to the power specified by the Self instance.

The ordinary (left) 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_Power function that raises the sum of the Self instance to the power of the passed instance.

Function Operator_PowerRight(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_Power function.