Re: parent constructor

From: Date: Thu, 30 Mar 2006 07:53:52 +0000
Subject: Re: parent constructor
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-232898@lists.php.net to get a copy of this message
Jasper Bryant-Greene wrote:
SLaVKa wrote:
Hey guys just a general question... if you have a parent::__constructor() call in your constructor function, should that call ideally be placed before or after the code inside the current constructor? or it doesnt really matter
That depends on which code you want to run first. Seriously.
true in practice but in theory the parent ctor should be called first before anything else is done - the theory is that the 'base of the object' should be completely setup before you construct stuff in the current level (which may rely on stuff that is configured/setup in the parent ctor). so, what Jasper said, basically. NB: it's parent::__construct() not parent::__constructor()
Jasper


« previous php.general (#232898) next »