We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › object deep copy
Page Index Toggle Pages: 1
object deep copy (Read 259 times)
object deep copy
Nov 27th, 2008, 2:51pm
 
is there something in processing that will let me do a deep copy easily?

i want to copy a custom object into a new instance without the new one referencing the old one.

eg:
Seed seed1 = new Seed();
Seed seed2 = seed1.Clone();
Re: object deep copy
Reply #1 - Nov 27th, 2008, 3:09pm
 
I don't think so. Making a generic Clone() would need a non-trivial use of reflection...

I believe you should make your own copy constructor, for example.
Re: object deep copy
Reply #2 - Nov 27th, 2008, 3:28pm
 
ok thanks for that.. thought it wouldve been good to ask

sometimes these things exist and when you find out about them theres usually a big "doh" involved Tongue
Page Index Toggle Pages: 1