[fpc-pascal] Operator overloading and generic class
Xiangrong Fang
xrfang at gmail.com
Tue Aug 26 10:17:10 CEST 2014
Hi All,
While I try to compile this code:
program demo;
{$mode objfpc}{$H+}
uses tree;
type
TIntTree = class(specialize TTree<Integer>)
end;
TITTree = class(specialize TTree<TIntTree>)
end;
operator <(it1, it2: TIntTree): Boolean;
begin
Result := it1.Data < it2.Data;
end;
var
itt: TITTree;
begin
end.
I got the following error:
tree.pas(324,11) Error: Operator is not overloaded: "TIntTree" < "TIntTree"
The complete code for tree.pas is here:
https://github.com/xrfang/fpcollection/blob/master/src/units/tree.pas
Even I defined the needed operator like above, it still refuse to compile.
How to solve this?
Thanks in advance!
Xiangrong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140826/89987b2f/attachment.html>
More information about the fpc-pascal
mailing list