[EMAIL PROTECTED] (Marcus B�rger) wrote:
> Nice idea, but one thing i wanted is to disable cloning of class objects.
>
> The following class makes cloning impossible for all derived classes:
> class no_clone {
> final private __clone() {}
> }
>
> but the all classes that should not be cloned must be descendants from that
> class. So the following interface would disallow cloning by default, although
> it allows derived classes to reenable cloning:
> interface no_clone {
> protected function __clone()
> }
>
> When dealing with classes that handle resources such techniques are very
> helpful to prevent users from shooting themselves in the knee.
I see. But, is it really a matter of interface? And why don't you declare
an alternative duplication method rather than __clone() whose usage is
reserved?
Moriyoshi
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php