note 75700 deleted from language.oop5.interfaces by felipe
| From: | felipe@php.net | Date: | Tue, 11 Dec 2007 01:00:27 +0000 |
| Subject: | note 75700 deleted from language.oop5.interfaces by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133344@lists.php.net to get a copy of this message | ||
Note Submitter: prometheus at php-sparcle
----
If I run the belowing code, I get an error message.
<?php
/**
* Testing of method overrideing on interfaces
*/
interface IFoo
{
public function Foo();
}
interface IBar extends IFoo
{
public function Foo($bar);
}
?>
The error message says: Fatal error: Can't inherit abstract function IFoo::Foo() (previously
declared abstract in IBar) in D:\www\svn\virgilius\interface_or_test.php on line 12
So I don't understand that if method overriding works fine in class instances, but not in
interfaces. BTW I think that is a typical situation when a standard method expanded by new
parameters in the later interface instances.
I know, I can do a workaround with the func_get_* functions, but it's a big ugly hack I think.
If I make a big class-hierarchie, I must make a lot of the above ugly think maybe, in a lot of
methods, maybe.
So I prefer to droping all my interfaces and don't use ever again this stucture, because
it's only make difficult to develop rather then it's make relieve and clean logically and
overviewable.
Peace.