Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10796 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17618 invoked by uid 1010); 27 Jun 2004 06:31:00 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 17558 invoked from network); 27 Jun 2004 06:30:59 -0000 Received: from unknown (HELO prp0.prp.physik.tu-darmstadt.de) (130.83.243.130) by pb1.pair.com with SMTP; 27 Jun 2004 06:30:59 -0000 Received: from prp0.prp.physik.tu-darmstadt.de (localhost [127.0.0.1]) by prp0.prp.physik.tu-darmstadt.de (8.12.3/8.12.3/SuSE Linux 0.6) with ESMTP id i5R6UwKf017226; Sun, 27 Jun 2004 08:30:58 +0200 Received: (from swalk@localhost) by prp0.prp.physik.tu-darmstadt.de (8.12.3/8.12.3/Submit) id i5R6UwUW017225; Sun, 27 Jun 2004 08:30:58 +0200 Date: Sun, 27 Jun 2004 08:30:58 +0200 To: Jason Davidson Cc: internals@lists.php.net Message-ID: <20040627063058.GA17165@prp0.prp.physik.tu-darmstadt.de> References: <18377.1088305392@zworg.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18377.1088305392@zworg.com> User-Agent: Mutt/1.3.27i Subject: Re: [PHP-DEV] Base and derived class construction From: swalk@prp.physik.tu-darmstadt.de (Stefan Walk) 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