Used to override a default operator with a custom one for the class. Not all operators can be overridden. You aren't allowed to declare new operators. For more on operators in general and which operators can be overridden, see [Operators]. For more on how to declare a custom operator, see [Custom operators].
All custom operators must be a static member of a class that the operator will take as a parameter. You are allowed to overload your custom operators.
(\public\|\protected\|\private\) override operator operator_id /type/ identifier returns /type/ 'code return SomeValue
Note: For what the "/type/
" means, see Type descriptors.
These operators are a little different as they can be prefixed (placed before their operand) or postfixed (placed after the operand). For this reason, each also has two keywords that might be referenced. The code below shows the prototypes you'll need.
public override operator ++ YourType (\prefix\ | \postfix\) identifier returns YourType public override operator -- YourType (\prefix\ | \postfix\) identifier returns YourType
This only change here is the addition of an extra parameter. The comma is required.
(\public\|\protected\|\private\) override operator operator_id /type/ identifier1, /type/ identifier2 returns /type/ 'code return SomeValue
ASIL doesn't yet define any operators of this type. But if it ever does, simply extend the above syntax to pass a third parameter.
Wiki: Appendices-Terms-Type descriptors
Wiki: Custom operators
Wiki: Events
Wiki: Keywords
Wiki: Operators
Wiki: keywords-static