Re: Interfaces in PHP

From: Date: Wed, 21 Aug 2002 10:41:30 +0000
Subject: Re: Interfaces in PHP
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-87225@lists.php.net to get a copy of this message
Wez Furlong wrote:
class C { delegatee $foo = new IFoo(); // "implements" IFoo by delegation delegatee $bar = new IBar(); // "implements" IBar by delegation } I didnt see anyone suggest this as an alternative to the delegatee syntax, - it just a bit clearer to read (to me anyway..)
class C extends something { extends IFoo as $foo; extends IBar as $bar; var .... function .... } .... just a thought.. regards alan
$c = new C(); if (has_a($c, "IFoo")) $c->foo(); if (has_a($c, "IBar")) $c->bar(); This "has_a" function/operator is one of the small things missing from the current delegation RFC, along with an "as" operator. For full details on this stuff, take a look at those archives - theres no need to keep going round in circles :-) --Wez.


« previous php.dev (#87225) next »