全て、
Delphi で、T_Test という単純なクラスを作成しました (以下を参照)。
T_Test = class(TObject)
private
F_Int : Integer;
public
constructor Create(inInt: Integer);
destructor Destroy; override;
property Int: Integer read F_Int write F_Int;
function showInt : String;
end;
constructor T_Test.Create(inInt: Integer);
begin
F_Int := inInt;
end;
destructor T_Test.Destroy;
begin
self.Free;
end;
function T_Test.showInt : String;
var outputLine : String;
begin
result := IntToStr(Int);
outputLine := result;
Form1.Memo1.Lines.Add(outputLine);
end;
次に、T_Test オブジェクトの TList を作成し、それらに対して showInt メソッド関数を呼び出すプロシージャがあります。
私はこのように試しました:
procedure testTlist;
var
a, b: T_Test;
i : Integer;
begin
a := T_Test.Create(5);
b := T_Test.Create(10);
listTest := TList.Create;
listTest.Add(a);
listTest.Add(b);
listTest[i].showInt;
end;
しかし、「listTest[i].showInt」の呼び出しでレコード、オブジェクト、またはクラス タイプを使用する必要があるというメッセージが表示され続けます。
このメソッドを呼び出す方法を知っている人はいますか?