Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29955 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37293 invoked by uid 1010); 30 May 2007 14:55:16 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 37278 invoked from network); 30 May 2007 14:55:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 May 2007 14:55:16 -0000 Authentication-Results: pb1.pair.com header.from=jochem@iamjochem.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jochem@iamjochem.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: jochem@iamjochem.com X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 Received: from [194.109.193.121] ([194.109.193.121:42951] helo=mx1.moulin.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/FB-51978-2509D564 for ; Wed, 30 May 2007 10:55:15 -0400 Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id 1B3D824DECE; Wed, 30 May 2007 16:55:18 +0200 (CEST) X-Virus-Scanned: amavisd-new at moulin.nl Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (mx1.moulin.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dt-KoM9fR6Tg; Wed, 30 May 2007 16:55:02 +0200 (CEST) Received: from [192.168.1.23] (bspr.xs4all.nl [194.109.161.228]) by mx1.moulin.nl (Postfix) with ESMTP id 7A50124DED5; Wed, 30 May 2007 16:55:02 +0200 (CEST) Message-ID: <465D9040.6030001@iamjochem.com> Date: Wed, 30 May 2007 16:54:56 +0200 User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: ceo@l-i-e.com CC: Ken Stanley , internals@lists.php.net References: <56275.216.230.84.67.1180484964.squirrel@www.l-i-e.com> In-Reply-To: <56275.216.230.84.67.1180484964.squirrel@www.l-i-e.com> X-Enigmail-Version: 0.94.2.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] late static binding From: jochem@iamjochem.com (Jochem Maas) Richard Lynch wrote: > Maybe I'm just confused (well, I'm always confused...) but if a Class > has multiple children, how the heck would PHP know which child:: to > call?... the use of the name 'child' is very confusing, I would prefer 'super' or 'static' ... regardless the concept is actually quite simple: interface DOInfo { static function getTableName(); } abstract class DataObject implements DOInfo { static function findRange() { $table = super::getTableName(); return $foo; // $foo is a collection of whatever (e.g. Product objects) } static function getTableName() { throw new Exception('be a dear and implement '.__METHOD__.' in your subclass'); } } class Product extends DataObject { static function getTableName() { return 'PRODS'; } } $products = Product::findRange(); excuse me if I've just committed a grave sin against the OO Codex in writing something that either isn't 'correct' or is syntactically incorrect according to the current state of php - hopefully the idea is clear anyway. >> >> - Ken >> -- >> It looked like something resembling white marble, which was >> probably what it was: something resembling white marble. >> -- Douglas Adams, "The Hitchhikers Guide to the >> Galaxy" >> > >