Re: Convertion question.
"Theo Bebekis" <[email protected]>
| Newsgroups | gmane.comp.lang.delphi.jedi |
|---|---|
| Message-ID | <000001c3a2da$d6c08fa0$8100a8c0@EPEKTASIS> |
Adrian > Hello... I am trying to migate a C++ program to Delphi. The problem that > I've found is that it uses a lot of "copy constructors" and I really don't > know if they exists in Delphi. I started by making a copy by hand for every > type object that I found but now it is impossible to manage. So... the > question is... Do copy constructors exist in Delphi? No, not really... IIRC copy constructors are involved because of the object model C++ utilizes. Objects, in C++, are more or less, similar to Object Pascal's records (i.e. structures) unless you create the object by using the new operator. When a (structure-like) object is passed to a function its copy constructor is called in order to create a copy of the object. When the object is really a pointer to a memory area there is no such need. (And as a plus you have the benefit of polymorphism of course) I hope I remember correct... The closest to the copy constructor notion of the C++ is the TPersistent.Assign() virtual method of the Object Pascal. Of course you have to override it and provide the extra assignments, inside the overriden methods, your derived classes demand. Theo ----------------------------------- Theo Bebekis Thessaloniki, Greece ----------------------------------- ------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511 http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/i7folB/TM ---------------------------------------------------------------------~-> To unsubscribe from this group, send an email to: [email protected] Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/