note 110671 added to reflection.extending

From: Date: Wed, 21 Nov 2012 13:47:18 +0000
Subject: note 110671 added to reflection.extending
Groups: php.notes 
Request: Send a blank email to php-notes+get-192055@lists.php.net to get a copy of this message
Note that calling self:: in the parent class does not call the child method. Example: class A { public function __construct() { $this->foo(); } public function foo() { self::bar(); } public function bar() { echo 'A'; } } class B extends A { public function bar() { echo 'B'; } } $b = new B; // Echoes A class C { public function __construct() { $this->foo(); } public function foo() { $this->bar(); } public function bar() { echo 'C'; } } class D extends C { public function bar() { echo 'D'; } } $d = new D; // Echoes D ---- Server IP: 69.147.83.199 Probable Submitter: 83.241.163.123 ---- Manual Page -- http://www.php.net/manual/en/reflection.extending.php Edit -- https://master.php.net/note/edit/110671 Del: integrated -- https://master.php.net/note/delete/110671/integrated Del: useless -- https://master.php.net/note/delete/110671/useless Del: bad code -- https://master.php.net/note/delete/110671/bad+code Del: spam -- https://master.php.net/note/delete/110671/spam Del: non-english -- https://master.php.net/note/delete/110671/non-english Del: in docs -- https://master.php.net/note/delete/110671/in+docs Del: other reasons-- https://master.php.net/note/delete/110671 Reject -- https://master.php.net/note/reject/110671 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#192055) next »