note 114320 added to language.oop5.interfaces
| From: | VasiliyMakogon | Date: | Thu, 06 Feb 2014 23:38:25 +0000 |
| Subject: | note 114320 added to language.oop5.interfaces | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198427@lists.php.net to get a copy of this message | ||
The class implementing the interface must use the exact same method signatures as are defined in the
interface. Not doing so will result in a fatal error. -- this documentation page.
But, if you use default values in arguments in methods, fatal error is not follow:
<?php
interface myInterface {
public function __construct();
}
class concret implements myInterface {
public function __construct($arg=null)
{
print_r(func_get_args());
}
}
$obj = new concret(123);
?>
Array ( [0] => 123 )
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/language.oop5.interfaces.php
Edit -- https://master.php.net/note/edit/114320
Del: integrated -- https://master.php.net/note/delete/114320/integrated
Del: useless -- https://master.php.net/note/delete/114320/useless
Del: bad code -- https://master.php.net/note/delete/114320/bad+code
Del: spam -- https://master.php.net/note/delete/114320/spam
Del: non-english -- https://master.php.net/note/delete/114320/non-english
Del: in docs -- https://master.php.net/note/delete/114320/in+docs
Del: other reasons-- https://master.php.net/note/delete/114320
Reject -- https://master.php.net/note/reject/114320
Search -- https://master.php.net/manage/user-notes.php