Re: Interface inheritance
| From: | Ferdinand Beyer | Date: | Tue, 20 Apr 2004 14:34:30 +0000 |
| Subject: | Re: Interface inheritance | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9418@lists.php.net to get a copy of this message | ||
On 19 Apr 2004 at 20:44, Marcus Boerger wrote:
> Simply decalre thos methos with an empty signature and use the
> appropriate functions to handle the arguments?
That does not work for foreign/internal interfaces/base classes.
Again: Why should we add this strictness? Since PHP is loosely
typed, you can't guarantee that a class is implementing an interface
correctly even if the method accepts the same number of
arguments...
I am NOT saying that Interfaces are useless (or would be without
strict arguments checking).
What about this case:
interface A {
public function doSomething($integer1, $integer2);
}
interface B {
public function doSomething(MyObject $obj);
}
class Impl implements A, B
{
// "Overloaded" - supports both doSomething() interfaces
public function doSomething()
{
// Use var_args to distinquish the two doSomething()'s
}
}
--
Ferdinand Beyer
<fb@fbeyer.com>