[Lazarus] operator overloading

Sven Barth pascaldragon at googlemail.com
Sun Feb 24 16:00:50 CET 2013


On 24.02.2013 15:51, Wildfire wrote:
> *From:* xrfang <mailto:xrfang at gmail.com>
> *Sent:* Sunday, February 24, 2013 7:31 AM
> *To:* Lazarus at lists.lazarus.freepascal.org
> <mailto:Lazarus at lists.lazarus.freepascal.org>
> *Subject:* [Lazarus] operator overloading
>  > operator < (p1, p2: TPainter) b: Boolean; <—method2
> Close, but no cigar...
> operator < (p1, p2: TPainter): Boolean;

Both variants will work. The variant with "b: Boolean" was originally 
introduced for the non-Object-Pascal modes (fpc, tp), because there you 
only have the name of the procedure/function as a result variable and as 
operators don't have names (in that sense) you can specify the name of 
the result variable. It works in the Object Pascal modes (delphi, 
objfpc) however as well.

Regards,
Sven





More information about the Lazarus mailing list