Hi Sven,

2013/9/26 Sven Barth <pascaldra...@googlemail.com>

>
> As you can see you are constructing a TTreeInteger class inside
> TTreeInteger.Clone and nothing in the world afterwards can turn it into a
> TTreeInt.
>

​Do you mean that casting TTreeInteger into TTreeInt is not possible
because this is to cast a parent class into a child class?  If so, how this
is possible (mentioned in my earlier question about avoid typecasting):

type
  TIntTree = class(specialize TTree<Integer>)
  end;

var
  it1, it2: TIntTree;
begin
  ... ...
  it2 := TIntTree(it1.FirstChild);
end.

This is also casting TTree$Integer (parent class) to TIntTree (child class)?

Regards,
Xiangrong
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to