note 123544 added to language.oop5.inheritance
| From: | Anonymous@php.net | Date: | Fri, 25 Jan 2019 07:21:17 +0000 |
| Subject: | note 123544 added to language.oop5.inheritance | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210110@lists.php.net to get a copy of this message | ||
PHP7 gives you a warning if you redeclare a function in a child class with different parameters. For
example:
class foo {
function print($text='') {
print text;
}
}
class bar extends foo {
function print($text1='',$text2='') {
print text1.text2
}
}
will give a PHP Warning: Declaration of bar::print($text1 = '', $text2 = '')
should be compatible with foo::print($text= '').
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.142 (proxied: 148.6.26.151)
----
Manual Page -- http://php.net/manual/en/language.oop5.inheritance.php
Edit -- https://master.php.net/note/edit/123544
Del: integrated -- https://master.php.net/note/delete/123544/integrated
Del: useless -- https://master.php.net/note/delete/123544/useless
Del: bad code -- https://master.php.net/note/delete/123544/bad+code
Del: spam -- https://master.php.net/note/delete/123544/spam
Del: non-english -- https://master.php.net/note/delete/123544/non-english
Del: in docs -- https://master.php.net/note/delete/123544/in+docs
Del: other reasons-- https://master.php.net/note/delete/123544
Reject -- https://master.php.net/note/reject/123544
Search -- https://master.php.net/manage/user-notes.php