Re: cloning $this php5

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

 



I don't think the clone function works on $this.

-- 
itoctopus - http://www.itoctopus.com
""blackwater dev"" <blackwaterdev@xxxxxxxxx> wrote in message 
news:34a9824e0705111302l30f842a4o96bbc307935b9af3@xxxxxxxxxxxxxxxxx
>I have a method within an class that should make a copy of itself, do some
> stuff on the copy and return it.  The object contains data members that 
> are
> references to other objects.  I basically want a brand new copy of the
> object.  The problem is, certain methods I call on the object throw this
> error:
>
> Call to undefined method stdClass::methodname
>
> I've tried to copy it with just =, =& and clone but they all through
> errors.  What am I doing wrong?
>
> Thanks!
>
> function morph(){
>
> $cloned_ob= clone $this;
>
> $cloned_ob->run();
> $cloned_ob->data_member="john";
>
> return $cloned_ob;
>
> }
> 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux