Re: Base and derived class construction

From: Date: Sun, 27 Jun 2004 06:30:58 +0000
Subject: Re: Base and derived class construction
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-10796@lists.php.net to get a copy of this message
On Sat, Jun 26, 2004 at 08:03:12PM -0700, Jason Davidson wrote: > Hi, is there a reason that when a child class is instantiated the parent > class constructor does not get called? > The obvious workaournd for this is to simply call > $this->parentConstructor(); in the child class constructor, however, > this seems strange.. parent::__construct(), to be exact :) > > Am i way off base here...? > > Thanks > Jason Most languages i know do that ("forcing" you to call super or alike). The only small "annoyance" i see is that parent::__construct() doesn't automatically use the parameters that were passed to the constructor, but i think one can live with that. Stefan

« previous php.internals (#10796) next »