'How to duplicate an object? [duplicate]
I'm on Delphi 11.
I need to create a new instance of a TIdMessage and TIDSmtp, simply by copying all properties from another TIdMessage and TIDSmtp. What's the best way to do it besides manually assigning the properties you need one by one?
var
newIdMessage : TIDMessage;
newIDSmtp : TIDSmtp;
begin
newIdMessage := TIDMessage.create;
newIdSmtp := TIDSmtp.create;
// something like this:
newIdMessage.copyPropertiesFrom(form1.IdMessage1);
newIdSmtp.copyPropertiesFrom(form1.IdSmtp1);
end;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
