[EMAIL PROTECTED] wrote:
Thanks! What would probably be a good thing, is to mention that in the docs
for the final keyword.


Make 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
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,
Andrey

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to