note 52531 added to language.oop5.interfaces
| From: | tobias_demuth at web dot de | Date: | Wed, 04 May 2005 21:21:40 +0000 |
| Subject: | note 52531 added to language.oop5.interfaces | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88939@lists.php.net to get a copy of this message | ||
The statement, that you have to implement _all_ methods of an interface has not to be taken that
seriously, at least if you declare an abstract class and want to force the inheriting subclasses to
implement the interface.
Just leave out all methods that should be implemented by the subclasses. But never write something
like this:
<?php
interface Foo {
function bar();
}
abstract class FooBar implements Foo {
abstract function bar(); // just for making clear, that this
// method has to be implemented
}
?>
This will end up with the following error-message:
Fatal error: Can't inherit abstract function Foo::bar() (previously declared abstract in
FooBar) in path/to/file on line anylinenumber
----
Manual Page -- http://www.php.net/manual/en/language.oop5.interfaces.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52531
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52531&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52531&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52531&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52531&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52531&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52531&report=yes
Search -- http://master.php.net/manage/user-notes.php