以下の構造を使用して、コレクションを格納するために TAnimalCollection クラスを定義するにはどうすればよいですか? SelectAll または SelectTop10 を呼び出すと、SelectedRecords が更新されます。private フィールドを削除すると、コードをコンパイルできますが、返された結果セットを格納するメカニズムはありません。
TDog = class
private
FBreed: string;
public
property Breed: string read FBreed write FBreed;
end;
TCat = class
private
IsWild: string;
public
property IsWild: string read FIsWild write FIsWild;
end;
TMyArray<T> = array of T;
TAnimalCollection = class
private
SelectedRecords: TMyArray<T>; // Generates: Undeclared Identifier: 'T'
public
function SelectAll<T>: TMyArray<T>;
function SelectTop10<T>: TMyArray<T>;
// Other Methods
end;