Re: Property Overloading RFC

From: Date: Tue, 02 Aug 2005 21:22:39 +0000
Subject: Re: Property Overloading RFC
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-17506@lists.php.net to get a copy of this message
My concern with the self::isVirtual() syntax would be... class Base {
    function __get($name) {
        if (!self::isVirtual($name))
            throw;
    }
} class Foo {
    abstract public $bar = 1;
} $f = new Foo; echo $f->bar; ... Are these 'virtual' members going to work like static members, in that using self:: in a base class doesn't allow access to those static members of inheriting classes? ie, will the above example throw an error or not, like it would if a similar thing with statics were to try and be done. Derick Rethans wrote:
This is ofcourse overly complicated. A better workable solution would be - without breaking BC (suggestions for syntax here are very welcome): <?php class Base {
    abstract public $x = 1;
    function __get($name)
    {
        if (!self::isVirtual($name))) {
            /* throw error */
        }
    }
} $b = new Base(); echo $b->foo; ?>


« previous php.internals (#17506) next »