【发布时间】:2009-10-12 07:44:16
【问题描述】:
考虑以下几点:
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
);
是否有其他方法可以获取作为另一个类的实例的字段值?
【问题讨论】:
标签: delphi field delphi-2010 rtti