On 26.02.2013 15:30, Xiangrong Fang wrote:
Hi Sven,My code below: =============================================== program project1; {$mode objfpc}{$H+} {$MODESWITCH advancedrecords} uses Classes; type TMyStringList = record StringList: TStringList; class operator <(s1, s2: TMyStringList): Boolean; end; class operator TMyStringList.<(s1, s2: TMyStringList): Boolean; begin Result := s1.StringList.Count < s2.StringList.Count; end; begin end. =============================================== generated these errors: project1.lpr(9,20) Error: It is not possible to overload this operator. Related overloadable operators (if any) are: project1.lpr(9,21) Error: It is not possible to overload this operator. Related overloadable operators (if any) are: project1.lpr(9,53) Error: Impossible operator overload project1.lpr(12,31) Error: method identifier expected project1.lpr(1,1) Fatal: Compilation aborted I am using Lazarus 1.0.6/FPC2.6.0-6 on Linux Mint 14/x86_64.
In addition to my previous mail: It will work in 2.6.0 if you compile in mode delphi (no $H+ and $modeswitch needed there) and you need to rename the operator from "<" to "LessThan" (this is the Delphi operator name).
Regards, Sven -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
