""Christoph Boget"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
<snip>
>
>> Singletons are not rocket science, but as with all patterns you really 
>> need
>> to understand the theory before trying to implement and use it.
>
> Agreed.  But apparently implementing them in PHP leaves things to be 
> desired.

There is absolutely nothing in PHP which prevents you from implementing the 
singleton pattern. There are several ways in which it can be done (take a 
look at http://www.tonymarston.net/php-mysql/singleton.html for an example) 
but your attempt is doomed to failure. What makes you think that a singleton 
class has to inherit from another class? Why can't it be a separate class, 
or even a separate method in an existing class? If you use a static method 
then the activities of the constructor are irrelevant.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to