Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25202 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87907 invoked by uid 1010); 4 Aug 2006 19:59:38 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 87892 invoked from network); 4 Aug 2006 19:59:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Aug 2006 19:59:38 -0000 X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from ([67.139.134.202:1546] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id F2/F3-49980-927A3D44 for ; Fri, 04 Aug 2006 15:59:38 -0400 Received: (qmail 62815 invoked by uid 98); 4 Aug 2006 19:59:38 -0000 Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-1.25 ( Clear:RC:1(127.0.0.1):. Processed in 0.066379 secs); 04 Aug 2006 19:59:38 -0000 X-Qmail-Scanner-Mail-From: ceo@l-i-e.com via o2.hostbaby.com X-Qmail-Scanner: 1.25 (Clear:RC:1(127.0.0.1):. Processed in 0.066379 secs) Received: from unknown (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 4 Aug 2006 19:59:38 -0000 Received: from 67.108.68.40 (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Fri, 4 Aug 2006 14:59:38 -0500 (CDT) Message-ID: <46570.67.108.68.40.1154721578.squirrel@www.l-i-e.com> In-Reply-To: <44D379E4.4050504@cweiske.de> References: <44D379E4.4050504@cweiske.de> Date: Fri, 4 Aug 2006 14:59:38 -0500 (CDT) To: "Christian Weiske" Cc: internals@lists.php.net Reply-To: ceo@l-i-e.com User-Agent: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] Method inheritance and parent classes From: ceo@l-i-e.com ("Richard Lynch") On Fri, August 4, 2006 11:46 am, Christian Weiske wrote: > I recently had a problem that could be solved, but in an ugly way: > Class B extended Class A. Both classes define a method with the same > name. B called A's constructor, and A called $this->method(). This > executed B::method(), not A::method() as you would expect it. Most OOP people expect it to run B::method() That's rather the whole point of inheritence and subclasses. If you need to override it, you might be able to use A::method()... Though the OO purists have made that illegal now, I think. :-; There may be some kind of get_method() function on a class that you could use like: $function = get_method('A', 'method'); user_call_func(array($this, $function)); -- Like Music? http://l-i-e.com/artists.htm