H
hsgrass
Unregistered / Unconfirmed
GUEST, unregistred user!
uses typinfo;
type
ttest1 = class(TPersistent)
private
Fhello: string;
published
property Hello: string read Fhello write Fhello;
end;
ttest2 = class(tobject)
private
Fhello: string;
published
property Hello: string read Fhello write Fhello;
end;
procedure TForm3.btn1Click(Sender: TObject);
var
t1: ttest1;
t2: ttest2;
begin
t1 := ttest1.Create;
t2 := ttest2.Create;
try
GetPropValue(t1, 'hello');
GetPropValue(t2, 'hello'); // 找不到属性
finally
t1.free;
t2.free;
end;
end;
type
ttest1 = class(TPersistent)
private
Fhello: string;
published
property Hello: string read Fhello write Fhello;
end;
ttest2 = class(tobject)
private
Fhello: string;
published
property Hello: string read Fhello write Fhello;
end;
procedure TForm3.btn1Click(Sender: TObject);
var
t1: ttest1;
t2: ttest2;
begin
t1 := ttest1.Create;
t2 := ttest2.Create;
try
GetPropValue(t1, 'hello');
GetPropValue(t2, 'hello'); // 找不到属性
finally
t1.free;
t2.free;
end;
end;