If I have understand concept correctly, I think this; http://gambasdoc.org/help/comp/gb/object%5B%5D/copy is little misleading. "Returns a deep copy of the array." Objects copied with this method doesn't seem to be deep copied (shallow copy instead).
Jussi On Thu, Jan 15, 2009 at 2:50 AM, Benoit Minisini <gam...@users.sourceforge.net> wrote: > On jeudi 15 janvier 2009, Jussi Lahtinen wrote: >> Hi! >> Again I'm having OO headache (I'm OO newbie). >> I have very simple task, and I believe the solution would be as >> simple... I just don't get it. >> I need to make independent copy of object, from collection A to collection >> B. >> >> I tried following (among other things): >> >> Dim A as NEW Collection >> Dim B as NEW Collection >> >> ... >> A.Add(B[n]) >> ... >> >> But the result is something like same object in both collections. >> When I do example; >> >> A[n].X = 1234 >> >> Then the corresponding object in collection B changes too; >> >> PRINT B[n].X >> 1234 >> >> I could do this; >> >> ... >> A[n].X = B[n].X >> A[n].Y = B[n].Y >> ...and so on... >> >> But those objects have very many variables, object arrays etc.! >> I really hope there is an other way... >> Thanks! >> >> >> Jussi >> > > Objects are handled by reference only. If you need to copy an object of your > own, you must do it yourself. Some native objects (like arrays) have a Copy() > method, but most don't. > > Regards, > > -- > Benoit Minisini > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user