note 125068 added to language.oop5.visibility

From: Date: Mon, 01 Jun 2020 21:16:20 +0000
Subject: note 125068 added to language.oop5.visibility
Groups: php.notes 
Request: Send a blank email to php-notes+get-214707@lists.php.net to get a copy of this message
When overriding a private method with a more visible child method, the parent method may be called instead. <?php class Parent { private function foo() { echo "Parent Foo\n"; } public function call_foo() { $this->foo(); } } class Child extends Parent { public function foo() { echo "Child Foo\n"; } } $bar = new Child(); $bar->call_foo(); $bar->foo(); ?> will output: Parent Foo Child Foo ---- Server IP: 45.112.84.4 Probable Submitter: 103.51.166.36 (proxied: 192.150.9.200) ---- Manual Page -- http://php.net/manual/en/language.oop5.visibility.php Edit -- https://master.php.net/note/edit/125068 Del: integrated -- https://master.php.net/note/delete/125068/integrated Del: useless -- https://master.php.net/note/delete/125068/useless Del: bad code -- https://master.php.net/note/delete/125068/bad+code Del: spam -- https://master.php.net/note/delete/125068/spam Del: non-english -- https://master.php.net/note/delete/125068/non-english Del: in docs -- https://master.php.net/note/delete/125068/in+docs Del: other reasons-- https://master.php.net/note/delete/125068 Reject -- https://master.php.net/note/reject/125068 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#214707) next »