[Tutor] Dynamic creation of class instances...
Erik Price
erikprice@mac.com
Wed, 22 May 2002 23:09:01 -0400
On Wednesday, May 22, 2002, at 10:58 AM, Israel Evans wrote:
> "How can I use an unknown object later on if I don't know it's name?
> Everything needs a name right? How can I even make the darn thing
> without a
> unique name?"
Don't forget that a single object can go by many names throughout its
life in a program. The name is nothing more than a reference to the
object itself, which provides you with a convenient "handle" that you
can use to attach it to your scripts or to other objects. But the
object really doesn't have a proper, unique "name" (at least as far as
you are concerned, perhaps to the interpreter there is something else
going on entirely).
Just make sure that you always have a "handle" on your object instance,
in other words, a reference to it. Otherwise it will slip from your
grasp like a helium balloon, eaten by the garbage collector.
Erik