Generic TypeIdenitifier convertion.How?
- by John
How do I convert the TypeIdenitifier to a class type? I need to use implicit convertion.
type
  TMyChildArray<T>=class(TMyArray<T>)
    private
      FData:Array of T;
      procedure AddEnd();
  end;
  TTypeIdenitifierParentClass=class(TAnotherParentClass)
    protected
      TestField:Cardinal;
  end;
  procedure TMyChildArray<T>.AddEnd();
  var elem:T;
  begin
    for elem in Fdata do
      TTypeIdenitifierParentClass(elem).TestField:=0;
  end;
I get "Invalid typecast" on the implicit convertion "TTypeIdenitifierParentClass(elem).TestField:=0;".
The principle I want to use is that the TypeIdenitifier will represent a class that descends from TTypeIdenitifierParentClass.There are many class types,but all of them descend that class.
How do I do this?