> Hello.
>
> While trying to use the operator overload feature of FPC, I find out a
> restriction not mentioned on the documentation. One can overload
> several operators but not the comparison one (=); this, at least, while
> operating on classes.
>
> The code below shows this situation (commenting out the "=" operator
> gives no error)
>
> Please, disregard this message if this is "as it should be". But I
> think that a small paragraph mentioning this "issue" could be included
> on the docs.

class=class operatorion is handled by the compiler and can't be
overloaded. Allowing this as overloaded operation will lead to ambigious
statements like

if (someclass=someclass)

what do you want to compare? the address of the class or the contents of
the class (like you overloaded example). And how to handle child classes?
Do the need to be implicitly cast to tsomeclass first or do you want the
pointer comparison only.



_______________________________________________
fpc-devel maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to