note 106351 deleted from language.oop5.paamayim-nekudotayim by tularis
| From: | tularis@php.net | Date: | Mon, 31 Oct 2011 15:08:07 +0000 |
| Subject: | note 106351 deleted from language.oop5.paamayim-nekudotayim by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184246@lists.php.net to get a copy of this message | ||
Note Submitter: 3dbox dot pl at gmail dot com
----
Tested with PHP 5.3.8
<?php
class FirstClass {
protected $constructTrace;
public function __construct(){
$this->constructTrace[] = "FirstClass::__construct()";
}
}
class SecondClass extends firstClass {
public function __construct(){
parent::__construct();
$this->constructTrace[] = "SecondClass::__construct()";
}
}
class ThirdClass extends secondClass {
public function __construct(){
parent::__construct();
$this->constructTrace[] = "ThirdClass::__construct()";
}
}
class SomeOtherClass extends thirdClass {
public function __construct(){
parent::__construct();
FirstClass::__construct();
$this->constructTrace[] = "SomeOtherClass::__construct()";
}
public function showConstructTrace(){
print_r($this->constructTrace);
}
}
$obj = new someOtherClass();
$obj->showConstructTrace();
// Array
// (
// [0] => firstClass::__construct()
// [1] => secondClass::__construct()
// [2] => thirdClass::__construct()
// [3] => firstClass::__construct()
// [4] => someOtherClass::__construct()
// )
?>