Hi All,
I wrote a TTree generic class, the code is here:
https://github.com/xrfang/fpcollection/blob/master/src/units/tree.pas
While using this class, I encountered the following problem:
program project1;
{$mode objfpc}{$H+}
uses tree;
type
TIntTree = class(specialize TTree<Integer>)
end;
var
ti : TIntTree;
begin
ti := TIntTree.Create(1, nil);
ti := ti.Next; <-- error here
end.The error message is:
Error: Incompatible types: got "TIntTree.TTree$LongInt" expected "TIntTree"
If I do not inherit TTree but just specialize it, there is no error.
How can I solve this problem so that I don' t have to use typecast everywhere?
Thanks,
Xiangrong
