Re: Re-2: [PHP-DEV] Re: declaring classes as static or final
| From: | Andrey Hristov | Date: | Wed, 29 Sep 2004 10:30:53 +0000 |
| Subject: | Re: Re-2: [PHP-DEV] Re: declaring classes as static or final | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-13066@lists.php.net to get a copy of this message | ||
michael.virnstein@brodos.de wrote:
Thanks! What would probably be a good thing, is to mention that in the docs for the final keyword.uses the same trick by declaring the constructor private (or protected) and making the __clone method also private so there is no way to clone the single instance (it is interesting that I have seen many slides discussing Singleton but quite a few mention that cloning of the object should be forbidden). Regards, AndreyMake the constructor private and the class final. No instance will be available, and no inheritance possible. Methods has to work, and therefore they may not expect to have $this available in them.Ok, will do, but this seems more like a hack to me, than an actual solution. ;) i'd find it much more readable with the static keyword, but it's not my decision. Regards, Michael I think it is disputable whether is hack or not :) As you probably know Singleton