"Chris Boget" <[EMAIL PROTECTED]> wrote in message
> Ok, let me see if I have this right:
> When you do:
> $var = new myClass();
> $var instantiates and holds a copy of myClass.

No.  The "new" operator makes a new object which is an instance of class

> But when you do:
> $var =& new myClass();
> $var instantiates and references that instantiation?

No, this is no different than your first example.  Maybe this is even a
syntax error, I'm not positive about that though.

> If so, then I'm curious - if you do:
> $var2 =& new myClass();
> and you modify the member variables in $var2, will the
> member variables of $var be modified as well?  Or does
> $var2 reference a seperate instantiation?

They are separate instances, because the "new" operator made a brand new
object each time it was called.  To make them reference the same object,
you'd instantiate $var1 and then do
$var2 =& $var1;

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to