TSomeObject =Class(TPersistent)
Private
FProp1:Integer;
FProp2:String;
Public
Procedure Assign(Source:TPersistent)
Published
property prop1:Integer Read Fprop1 Write FProp1;
property prop2:String Read Fprop2 Write FProp2;
end;
var
Source:Tpersistent;
TSomeObject(Sourec).Prop1;这里,TSomeObject是从Tpersistent类继承过来得,难道必须要他们有相同得祖先吗?
Private
FProp1:Integer;
FProp2:String;
Public
Procedure Assign(Source:TPersistent)
Published
property prop1:Integer Read Fprop1 Write FProp1;
property prop2:String Read Fprop2 Write FProp2;
end;
var
Source:Tpersistent;
TSomeObject(Sourec).Prop1;这里,TSomeObject是从Tpersistent类继承过来得,难道必须要他们有相同得祖先吗?
如果Source:= TSomeObject.Create;
则TSomeObject(Source)可以使用,否则不能