Re: "Bless"ing an object

From: Date: Wed, 26 Nov 2003 10:37:46 +0000
Subject: Re: "Bless"ing an object
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-171018@lists.php.net to get a copy of this message
Hi,
Hmm, seriailze and deserialize.. Don't think that's what I would want to do. You probably mean that I can serialize an object, hack the string to change the Class reference. That's not really what I want to do. more or less yes
Right now I'm hacking through it by *) Creating a new instance of the desired class ($New = new OtherClass()) *) Copy all attributes (foreach($this as $Key=>$Value) $New[$Key] = $Value) *) Replace the "$this" var ($this = $New) Not the best solution, I now .. But it works, currently. Please, there must be another way to do this ! Unfortunately I don't think so. There isn't a single step solution to this problem in Java either if that's any consolation to you :-)
Wouter
-- Raditha Dissanayake. ------------------------------------------------------------------------ http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar.

« previous php.general (#171018) next »