note 110671 deleted from reflection.extending by aharvey
| From: | aharvey@php.net | Date: | Thu, 22 Nov 2012 00:29:12 +0000 |
| Subject: | note 110671 deleted from reflection.extending by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192066@lists.php.net to get a copy of this message | ||
Note Submitter: hurbel at yahoo dot com
----
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