Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24812 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32981 invoked by uid 1010); 21 Jul 2006 09:32:16 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 32965 invoked from network); 21 Jul 2006 09:32:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jul 2006 09:32:16 -0000 X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.94.239.5 jdi.jdi-ict.nl Linux 2.5 (sometimes 2.4) (4) Received: from ([82.94.239.5:48693] helo=jdi.jdi-ict.nl) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id B5/44-29121-02F90C44 for ; Fri, 21 Jul 2006 05:32:16 -0400 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.13.6/8.12.11) with ESMTP id k6L9WDcg015933; Fri, 21 Jul 2006 11:32:13 +0200 Date: Fri, 21 Jul 2006 11:30:34 +0200 (CEST) X-X-Sender: derick@localhost To: Mike Bretz cc: internals@lists.php.net In-Reply-To: <44C09BE7.2010105@metropolis-ag.de> Message-ID: References: <44C09BE7.2010105@metropolis-ag.de> X-Face: "L'&?Ah3MYF@FB4hU'XhNhLB]222(Lbr2Y@F:GE[OO;"F5p>qtFBl|yVVA&D{A(g3[C}mG:199P+5C'v.M/u@Z\![0b:Mv.[l6[uWl' MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] RfC: rethink OO inheritance strictness From: derick@php.net (Derick Rethans) On Fri, 21 Jul 2006, Mike Bretz wrote: > Michael Wallner wrote: > > mike@honeybadger:~/build/php-unicode-debug$ cli > > -d"error_reporting=8191" -r 'class c{function f(){}} class d extends > > c{function f($a){}}' > > Fatal error: Declaration of d::f() must be compatible with that of > > c::f() in Command line code on line 1 > > > > > > I *really* think that this enforcements are no good idea and I _beg_ > > you that we leave this "area" to interfaces. > +1 > > In real live "C++" world I often have parent classes with function f() > and an extended class which also uses the function name f(..) but with > other, possibly class specific, variables, which then calls parent > f()... I do not see a good reason to enforce that both functions must be > exactly the same when extending, especially since c::f() does not get > called automatically, _when_ overwriting it in class d. It's quite a different thing in C++ as there you have method overloading which PHP doesn't have. Therefore your argument doesn't hold here as they are simply *two different* methods, and not an overriden one. In your code that uses the derived class you can still use both methods (one without, and the one with parameters). Derick