note 80956 added to language.oop5.abstract
| From: | remi dot alvado at gmail dot com | Date: | Fri, 08 Feb 2008 10:21:31 +0000 |
| Subject: | note 80956 added to language.oop5.abstract | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135896@lists.php.net to get a copy of this message | ||
I think there is actually an issue in your object model. Indeed, the following code does not work :
[PHP]
<?
interface Foo {
public function myFoo();
}
abstract class Bar implements Foo {
public abstract function myFoo();
public abstract function myBar();
public function myBar2() {
echo "myBar2";
}
}
class myImplementation extends Bar {
public function myFoo() {
echo "Foo";
}
public function myBar() {
echo "Bar";
}
}
?>
[/PHP]
Your only chance to make it work is to remove the declaration of abstract method "myFoo"
into abstract class "Bar". From my point of view, it is quite strange (PHP seems to
consider interface as "special" abstract class (which is not completly wrong)) but it
works like that. Took me some time to understand this ;)
----
Server IP: 69.147.83.197
Probable Submitter: 192.54.193.53
----
Manual Page -- http://www.php.net/manual/en/language.oop5.abstract.php
Edit -- https://master.php.net/note/edit/80956
Del: integrated -- https://master.php.net/note/delete/80956/integrated
Del: useless -- https://master.php.net/note/delete/80956/useless
Del: bad code -- https://master.php.net/note/delete/80956/bad+code
Del: spam -- https://master.php.net/note/delete/80956/spam
Del: non-english -- https://master.php.net/note/delete/80956/non-english
Del: in docs -- https://master.php.net/note/delete/80956/in+docs
Del: other reasons-- https://master.php.net/note/delete/80956
Reject -- https://master.php.net/note/reject/80956
Search -- https://master.php.net/manage/user-notes.php