Hi All, I have this generic class:
type generic TTree<T> = class private FItems: TList; ... ... public Data: T; ... ... function FirstChild: TTree; ... ... end; function TTree.FirstChild: TTree; begin if FItems.Count = 0 then Exit(nil); Exit(TTree(FItems[0])); end; when using it, I did: type TStringTree = specialize TTree<string>; It generated a compilation error: Error: Incompatible types: got "TTree" expected "TTree$AnsiString" on the line "Exit(TTree(FItems[0]));" of function FirstChild. And I tried to change it to: Exit(TTree<T>(FItems[0])); But is not accepted. How to solve this? thanks.
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal