note 123837 added to language.oop5.inheritance

From: Date: Fri, 10 May 2019 06:23:59 +0000
Subject: note 123837 added to language.oop5.inheritance
Groups: php.notes 
Request: Send a blank email to php-notes+get-211000@lists.php.net to get a copy of this message
Overriding a method which is called from base class works like this: <?php class Foo { public function printItem($string) { echo 'Foo: ' . $string; } public function printPHP($string) { $this->printItem($string); } } class Bar extends Foo { public function printItem($string) { echo 'Bar: ' . $string ; } } $foo = new Foo(); $bar = new Bar(); $foo->printPHP('baz'); //Foo: baz $bar->printPHP('baz'); //Bar: baz ?> ---- Server IP: 208.43.231.9 Probable Submitter: 185.85.3.142 (proxied: 84.118.149.114) ---- Manual Page -- http://php.net/manual/en/language.oop5.inheritance.php Edit -- https://master.php.net/note/edit/123837 Del: integrated -- https://master.php.net/note/delete/123837/integrated Del: useless -- https://master.php.net/note/delete/123837/useless Del: bad code -- https://master.php.net/note/delete/123837/bad+code Del: spam -- https://master.php.net/note/delete/123837/spam Del: non-english -- https://master.php.net/note/delete/123837/non-english Del: in docs -- https://master.php.net/note/delete/123837/in+docs Del: other reasons-- https://master.php.net/note/delete/123837 Reject -- https://master.php.net/note/reject/123837 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#211000) next »