Re: Add methods to object dinamically

From: Date: Tue, 26 Oct 2004 18:21:11 +0000
Subject: Re: Add methods to object dinamically
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-200377@lists.php.net to get a copy of this message
Greg Beaver wrote:
Sort of :) In PHP5, this will work.
[...] Very nice, thanks a lot :-)
However, you won't have access to private or protected data members.
Damn! that's exactly what I want! :-(
It is always better to rigidly define your methods, and extend the class as someone else suggested.
The problem is that I need to serialize some objects to put them on a database, but I'll have problems when some of these objects contains another ones from third parties where I do not control the inheritance and I've not access directly to object fields. Converting the object to an array is useful for serialization, as I can access private and protected object member values, but I cannot unserialize them because I cannot wrote those members again. Never mind. I surely must rethink the matter again. Thanks a million, Greg.

« previous php.general (#200377) next »