Operator_PowerRight Method

Used to overload the ^ operator, providing custom functionality.

Syntax

# 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 methods are always preferred; REALbasic uses the Right versions only if there is no legal left version.

# Example

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
Dim a, b as Integer
a= Self.x + Self.y
b=lhs.x + lhs.y
Return b ^a

# See Also

^ operator; Operator_Power function.