Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10837 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73129 invoked by uid 1010); 29 Jun 2004 17:57:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 72831 invoked from network); 29 Jun 2004 17:57:16 -0000 Received: from unknown (HELO mx.thebrainroom.net) (69.55.226.195) by pb1.pair.com with SMTP; 29 Jun 2004 17:57:16 -0000 Received: by mx.thebrainroom.net (Postfix, from userid 517) id 3983414880CE; Tue, 29 Jun 2004 10:56:11 -0700 (PDT) Received: from BAUMBART (pD95F897C.dip.t-dialin.net [217.95.137.124]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by mx.thebrainroom.net (Postfix) with ESMTP id EDBAD14880CC; Tue, 29 Jun 2004 10:56:08 -0700 (PDT) Date: Tue, 29 Jun 2004 19:57:13 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1578803583.20040629195713@marcus-boerger.de> To: Jason Davidson Cc: internals@lists.php.net In-Reply-To: <23680.1088374352@zworg.com> References: <23680.1088374352@zworg.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on jc.thebrainroom.net X-Spam-Status: No, hits=0.8 required=5.0 tests=PRIORITY_NO_NAME autolearn=no version=2.63 X-Spam-Level: X-TBR-Filter: Virus scanned and defanged Subject: Re: [PHP-DEV] Base and derived class construction From: helly@php.net (Marcus Boerger) Hello Jason, to be honest i don't really care. Since i am a C++ guy who loves types i'd appreciate automatic calling of inherited constructors/destructors. But php does not have types and so the non implicit calling version gives us a little bit more flexibility. Since we also don't have polymorphism the current solution seems to fit best. I hope this is a better answer. A thing which could be changed though (if we haven't fixed down everything in that area) is to change to automatically call inherited destructors. regards marcus Monday, June 28, 2004, 12:12:32 AM, you wrote: > Quite possible you had something else in mind, im just interested in > knowing why its done this way, is it for performance sake, is it > becuase you beleive php is more flexable this way, is it becuase it > just happened to be as such... > Im not being critical, Im being curious... > Jason > Marcus Boerger wrote: >> >> Hello Jason, >> >> maybe this time we neither had c++ nor java in mind, this time it was >> delphi. >> >> regards >> marcus >> >> >> Sunday, June 27, 2004, 8:44:45 AM, you wrote: >> >> > which languages is this normal too.. >> > if you refer to java, that uses the 'super' function, you need only >> > explicitly call super if your constructor has arguments, otherwise an >> > implicit call is made to the parents defualt constructor ( one with >> > arguments). >> > c++ also will call the parent defualt constructor automatically as well >> > i beleive. >> > that aside, i do release my mistake in the workaround, ive noted the >> > use of parent::__construct(). >> > im not really concerned with coding, i was more simply interested in why >> > it was done this way, in such a way, that a child class can be >> > inherited with parent class construction. >> >> > Jason >> >> > Stefan Walk wrote: >> >> >> >> 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 >> >> >> >> -- >> >> PHP Internals - PHP Runtime Development Mailing List >> >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> >> >> >> >> >> >> -- >> Best regards, >> Marcus mailto:helly@php.net >> >> -- Best regards, Marcus mailto:helly@php.net