note 16762 deleted from keyword.extends by jimw

From: Date: Fri, 16 Nov 2001 00:38:16 +0000
Subject: note 16762 deleted from keyword.extends by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20900@lists.php.net to get a copy of this message
Here is a limitation of class inheritance: A subclass may call the constructor of its parent, but its parent's constructor cannot call another function in the parent class. class a { function a() { $this->init() } function init() { print("hello from a!"); } }; class b extends a { function b() { parent->a() init(); } function init() { print("hello from b!"); } }; $bb = new b(); will not print hello from a hello from b but hello from b hello from b

« previous php.notes (#20900) next »