Hello Michael,

Wednesday, September 29, 2004, 11:44:04 AM, you wrote:


>> > 2. final classes:
>> > final classes can't be extended
>>
>> already supported

> Cannot find it in the docs.
> http://www.php.net/manual/en/language.oop5.final.php doesn't seem to have
> any comments on that.
> I'm not at home at the moment, so i couldn't try, but are you really sure
> that final CLASSES are supported?
> You're not confusing it with final METHODS, right?

Nope, i invented both final and abstract for both classes and methods :-)

> A good example for a static class imo, would be e.g. PEAR's DB Class. The
> DB-Class itself doesn't need to be instantiate,
> it simply works as factory and has some functions to check stuff. that'd be
> a class that i would define as
> "final static class DB {}". The class should not be extended and should not
> containt non static methods or attributes. Sure it isn't
> a big deal, if ppl are instantiating the DB Class, but it only has static
> methods and instantiating it wouldn't make any sense.

Ah so it is just a little bit more enforcement then the following:

final class DB
{
    // prevent instantiation
    private function __construct() { exit(0); }

    // The following is not needed because the constructor cannot be called
    // private function __clone() { exit(0); }
}


-- 
Best regards,
 Marcus                            mailto:[EMAIL PROTECTED]

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

Reply via email to