Operator_Negate Method

Syntax

# Notes

Used to overload the - operator when used for negation, providing custom functionality.

Create an Operator_Negate function in a class to specify the functionality of the - operator for that class.

In the function, the definition of negation is given for the Self instance only. No parameters are passed.

# Example

In this example, the negation of the Vector class (see Operator_Add), a class with two Integer properties, x and y, is defined as the negative of the square length of the vector.

Function Operator_Negate as Integer
Dim a as Integer
a= Self.x ^2 + Self.y ^2
Return -a

# See Also

- operator.