Hello all,

I'm playing around with 5.3, and I noticed the following interesting behavior:


class A
{

    private static $cls = __CLASS__;

    public static function who()
    {
        print static::$cls;
    }

}

class B extends A
{

    private static $cls = __CLASS__;

}

B::who(); // Fatal error: Cannot access private property B::$cls

I understand why this is happening, but IMO, this should not be
throwing an error. If "static" is supposed to be referencing the
"called class", we need a way to access ALL of the variables of that
class from its parent classes. Otherwise, there is no way to create
static class variables that won't be inherited in a hierarchy. If
there is, and I'm missing it, please forgive me and point it out.

Regards,

Michael

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

Reply via email to