Re: Interfaces in PHP
| From: | Wez Furlong | Date: | Wed, 21 Aug 2002 10:07:41 +0000 |
| Subject: | Re: Interfaces in PHP | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-87224@lists.php.net to get a copy of this message | ||
Did you guys re-read the discussion in the ZE2 archives as I suggested?
In brief:
class IFoo {
function foo() {}
}
class IBar {
function bar() {}
}
class C {
delegatee $foo = new IFoo(); // "implements" IFoo by delegation
delegatee $bar = new IBar(); // "implements" IBar by delegation
}
$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.