I think what Terence was talking about is more like this:

class A
{
}

class AProxifier
{
    protected function protectedMethod() {...}

    function getAProxy()
    {
        return new class extends A { /* How do you call
AProxifier->protectedMethod() here? */ };
    }
}

This is possible with anonymous functions, that's a big feature of PHP5.4.
And for the same reasons might be expected here too?
I don't have the answer, just raising the point.


(new class ...
>>      protected $value;
>>      public function __construct($value)
>>      {
>>          $this->value = $value;
>>      }
>>
>>      public function doSomething()
>>      {
>>          echo $this->value;
>>      })($val)
>>
>

Btw, I can't get used to ($val) beeing at the end of the declaration. I
feel it very confusing.

Nicolas

Reply via email to