note 58426 deleted from language.oop5.decon by cmb

From: Date: Mon, 07 Sep 2015 21:22:50 +0000
Subject: note 58426 deleted from language.oop5.decon by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-203731@lists.php.net to get a copy of this message
Note Submitter: derk AT oneindig DOT com ---- If a constructor is not present in a child class, php5 will try to call a constructor from the parent class. This behaviour can be used to somewhat simulate constructor chaining. <?php abstract class Parent { function __construct() { echo "Parent constructor called\n"; $this->myConstruct(); } } class Child extends Parent { function myConstruct() { echo " Child 'contructor' called"; } } $c = new Child(); ?> will output: Parent constructor called Child 'constructor' called

« previous php.notes (#203731) next »