Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2005 Apr : TPersistent.Clone ?

www.cryer.info
Managed Newsgroup Archive

TPersistent.Clone ?

Subject:TPersistent.Clone ?
Posted by:"Ian Boyd" (ian.borlandnews0..@avatopia.com)
Date:Fri, 15 Apr 2005 10:56:25

i want to duplicat an object that implements Assign/AssignTo.

Problem is, i don't know what class type the object is.

Is there a routine similar to:

function Clone(Source: TPersistent): TPersistent;
var
    MyClass: TMyClass;
begin
    MyClass := TMyClass(Source.ClassType);
    Result := MyClass.Create(MyCustomConstructionParameters);
    Source.AssignTo(Result);
end;

Replies:

www.cryer.info
Managed Newsgroup Archive