note 58147 added to language.oop5.interfaces
| From: | spiritus dot canisatgmaildotcom at osu1 dot php dot net | Date: | Tue, 25 Oct 2005 17:45:49 +0000 |
| Subject: | note 58147 added to language.oop5.interfaces | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97587@lists.php.net to get a copy of this message | ||
Regarding the example by cyrille.berliat:
This is not a problem and is consistent with other languages. You'd just want to use
inheritance like so:
<?php
class AbstractClass {
public function __ToString ( ) { return 'Here I am'; }
}
class DescendantClass extends AbstractClass {}
interface MyInterface {
public function Hello ( AbstractClass $obj );
}
class MyClassOne implements MyInterface {
public function Hello ( AbstractClass $obj ) {
echo $obj;
}
} // Will work as Interface Satisfied
$myDC = new DescendantClass() ;
MyClassOne::Hello( $myDC ) ;
?>
----
Manual Page -- http://www.php.net/manual/en/language.oop5.interfaces.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58147
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58147&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58147&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58147&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58147&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58147&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58147&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58147&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58147&report=yes
Search -- http://master.php.net/manage/user-notes.php