Re: Singletons

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

 



>> Apart from making the constructor
>> private, is there any way I can ensure that there is ever only one
>> instance of an object?
> you could use the magic method __clone.
> For example:
> public function __clone() { trigger_error('The singleton pattern avoids
> cloning this instance', E_USER_ERROR); }

Adding the above to my sample class (from my OP) did nothing.  Should it have?

thnx,
Christoph

-- 
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