note 75700 added to language.oop5.interfaces
| From: | prometheusatphp-sparcle at osu1 dot php dot net | Date: | Tue, 12 Jun 2007 16:05:43 +0000 |
| Subject: | note 75700 added to language.oop5.interfaces | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127419@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 91.82.32.82
----
Manual Page -- http://www.php.net/manual/en/language.oop5.interfaces.php
Edit -- https://master.php.net/note/edit/75700
Del: integrated -- https://master.php.net/note/delete/75700/integrated
Del: useless -- https://master.php.net/note/delete/75700/useless
Del: bad code -- https://master.php.net/note/delete/75700/bad+code
Del: spam -- https://master.php.net/note/delete/75700/spam
Del: non-english -- https://master.php.net/note/delete/75700/non-english
Del: in docs -- https://master.php.net/note/delete/75700/in+docs
Del: other reasons-- https://master.php.net/note/delete/75700
Reject -- https://master.php.net/note/reject/75700
Search -- https://master.php.net/manage/user-notes.php