Show/Hide Toolbars

XSharp

Overloadable unary operator expected

 

Something that looks like an overloaded unary operator has been declared, but the operator is missing or is in the wrong location in the signature.

 

A unary operator is an operator that operates on a single operand. For example, ++ is a unary operator. You can overload some unary operators by using the operator keyword and specifying a single parameter of the type that the operator operates on. For example, if you want to overload the operator ++ for a user-defined class Temperature so that you can write Temperature++, you can define it in this way:

 

 

 

 

 

When you receive this error, you have declared something that looks like an overloaded unary operator, except that the operator itself is missing or is in the wrong location in the signature. If you remove the ++ from the signature in the previous example, you will generate XS1019.

 

The following code generates XS1019:

 

 

// XS1019.prg