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;
> ?>

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

Reply via email to