Hello Moriyoshi,
Thursday, July 3, 2003, 7:13:44 PM, you wrote:
MK> [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.
MK> I see. But, is it really a matter of interface? And why don't you declare
MK> an alternative duplication method rather than __clone() whose usage is
MK> reserved?
Clone is always there unless you hide it. And only when it is hidden object
cloning is disallowed. So whatever else you declare doesn't hinder __clone
from working.
--
Best regards,
Marcus mailto:[EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php