swarm-modeling
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about List Objects...


From: Paul Johnson
Subject: Re: Question about List Objects...
Date: Thu, 13 Apr 2000 13:51:09 -0500

Christoph Andreas Vanberg wrote:
> 
> Hi,
> 
> I'm trying to figure out what exactly happens when I do the following:
> 
> newList = [oldList copy: aZone];
> 
> Does this command make a copy of the list which contains pointers to the
> same objects, or does it make copies of the objects as well?
> 
> Does anyone know?
> 
You might check the swarm-support archives on this, as it has come up
several times in the time I've been here.  The copy does not do a deep
copy and duplicate objects, it just does a shallow copy of the pointers
to the objects that are in the list.  If you need to duplicate objects,
you should write a method in your class that does it, that way you make
sure all features are created and copied. THen you can add those copies
to the newList.

-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700


                  ==================================
   Swarm-Modelling is for discussion of Simulation and Modelling techniques
   esp. using Swarm.  For list administration needs (esp. [un]subscribing),
   please send a message to <address@hidden> with "help" in the
   body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]