unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Generics.Collections;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
type
TMyClass1 = class(TObject)
Dummy : String;
end;
TMyClassList1 = class(TObjectList<TMyClass1>);
TMyClass2 = class(TObject)
Test : Integer;
end;
TMyClassList2 = class(TObjectList<TMyClass2>);
var
Form1: TForm1;
AMyClassList1 : TMyClassList1;
AMyClassList2 : TMyClassList2;
AObjectList : TObjectList<TObject>; // ???
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
AObjectList := AMyClassList1; // Compiler-Error
AObjectList := AMyClassList2;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
AMyClassList1 := TMyClassList1.Create(True);
AMyClassList2 := TMyClassList2.Create(True);
end;
end.