次の点を考慮してください。
TFieldType = class
fValue: string;
end;
TMainClass = class
private
Ffield: TFieldType;
public
function GetValue: string;
end;
TMainClass.GetValue では、TMainClass フィールドの値を取得しようとしています。
function TMainClass.GetValue;
begin
vCtx := TRTTIContext.Create;
vType := vCtx.GetType(Self.ClassInfo);
for vField in vType.GetFields do
vField.GetValue(
//Here's the trouble, because i don't know how to get the instance
);
別のクラスのインスタンスであるフィールドの値を取得する別の方法があるでしょうか?