comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Copying objects
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Copying objects [message #18093] Tue, 30 November 1999 00:00 Go to previous message
James Tappin is currently offline  James Tappin
Messages: 54
Registered: December 1995
Member
Is there a "clean" way to make a copy of an object. The best I could do for a
nice easy case with no pointers or object references in the class was:

pro Object1::set_all, tstr
for i = 0, n_tags(tstr)-1 do self.(i) = tstr.(i)
end

function Object1::copy
temp = {object1}
for i = 0, n_tags(temp)-1 do temp.(i) = self.(i)
newobj = obj_new('object1')
newobj -> set_all, temp
return, newobj
end

While it works, it seems to be a bit of a kludge. Is there a better way?

James
--
+------------------------+-------------------------------+-- -------+
| James Tappin | School of Physics & Astronomy | O__ |
| sjt@star.sr.bham.ac.uk | University of Birmingham | -- \/` |
| Ph: 0121-414-6462. Fax: 0121-414-3722 | |
+--------------------------------------------------------+-- -------+
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: copying objects
Next Topic: =?utf-8?B?4peY4pa6TGVnYWxseSBBY2Nlc3MgRlJFRSBTYXRlbGxpdGUgVFYgb24geW91ciBQQ+KXhOKXmA==?=

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:52:44 PDT 2025

Total time taken to generate the page: 0.00477 seconds