[Lazarus] operator overloading

xrfang xrfang at gmail.com
Sun Feb 24 16:02:57 CET 2013


I will test again tomorrow to find out what's wrong with my code.  For now, one more queston:

I noticed that generics does not work without {$mode objfpc}.  I wonder what is the default mode without $mode? Why objfpc is not the default mode?

在 日, 2月 24, 2013 at 11:00 下午,Sven Barth <pascaldragon at googlemail.com> 写道:
On 24.02.2013 15:51, Wildfire wrote: 
> *From:* xrfang 
> *Sent:* Sunday, February 24, 2013 7:31 AM 
> *To:* 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 


-- 
_______________________________________________ 
Lazarus mailing list 
Lazarus at lists.lazarus.freepascal.org 
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130224/ba87a152/attachment-0003.html>


More information about the Lazarus mailing list