>
> What should work is the following (now with generics again):
>
> === code begin ===
>
> type
>   TTree<T> = class
>   private type
>     TSelfClass = class of TTree;
>   public
>     function Clone: TTree;
>   end;
>
> function TTree.Clone: TTree;
> begin
>   Result := TSelfClass(Self.ClassType).**Create(Data, FParent);
>   (* ... *)
> end;
>
> ​After change to this code in Clone(), I got this error:

​

​tree.pas(66,60) Error: Incompatible type for arg no. 2: Got
"TIntTree.TTree$LongInt", expected "TTree"
​
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to