note 16763 added to keyword.extends

From: Date: Mon, 12 Nov 2001 16:47:22 +0000
Subject: note 16763 added to keyword.extends
Groups: php.notes 
Request: Send a blank email to php-notes+get-20762@lists.php.net to get a copy of this message
I am revising the code from my previous posting. This *tested* code demonstrates the limitation of calling a the parent class's constructor: class a { function a() { $this->init(); } function init() { echo 'hello from a -- '; } }; class b extends a { function b() { parent::a(); $this->init(); } function init() { echo 'hello from b -- '; } }; $bb = new b(); --results in hello from b! -- hello from b! instead of the expected: hello from a! -- hello from b! -- http://www.php.net/manual/en/keyword.extends.php http://master.php.net/manage/user-notes.php?action=edit+16763 http://master.php.net/manage/user-notes.php?action=delete+16763 http://master.php.net/manage/user-notes.php?action=reject+16763

« previous php.notes (#20762) next »