5
는 다음과 같은 고려 : TMainClass.GetValue에서RTTI를 사용하여 Delphi에서 액세스 필드를 얻는 방법은 무엇입니까?
TFieldType = class
fValue: string;
end;
TMainClass = class
private
Ffield: TFieldType;
public
function GetValue: string;
end;
I 해요 노력 얻을 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
);
의 인스턴스 필드의 값을 가져 오는 또 다른 방법이 될 수 있습니다 다른 클래스?
고마워, 나는이 기사를 읽었지만 그렇게 열심히하지 않는 것 같다. 귀하의 대답은 내 문제를 해결합니다. – boombastic