Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33285 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2591 invoked by uid 1010); 19 Nov 2007 06:14:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 2575 invoked from network); 19 Nov 2007 06:14:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2007 06:14:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=sam@sambarrow.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sam@sambarrow.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sambarrow.com from 205.234.132.11 cause and error) X-PHP-List-Original-Sender: sam@sambarrow.com X-Host-Fingerprint: 205.234.132.11 scottsdale.servershost.net Received: from [205.234.132.11] ([205.234.132.11:52860] helo=scottsdale.servershost.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AB/1E-31009-AC921474 for ; Mon, 19 Nov 2007 01:14:35 -0500 Received: from [216.15.51.211] (port=50416 helo=[192.168.1.90]) by scottsdale.servershost.net with esmtpsa (SSLv3:RC4-MD5:128) (Exim 4.68) (envelope-from ) id 1Itztz-0004OE-Nv; Mon, 19 Nov 2007 00:14:35 -0600 To: Larry Garfield Cc: internals@lists.php.net In-Reply-To: <200711190011.37405.larry@garfieldtech.com> References: <1195140437.23612.5.camel@sbarrow-desktop> <1195450232.12342.25.camel@sams-room> <200711190011.37405.larry@garfieldtech.com> Content-Type: text/plain Date: Mon, 19 Nov 2007 01:14:32 -0500 Message-ID: <1195452872.27909.11.camel@sams-room> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - scottsdale.servershost.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - sambarrow.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] Multiple class inheritance From: sam@sambarrow.com (Sam Barrow) I was considering something like this, just seems like more of a hack to me than the right way to do it, plus the performance hit you mentioned. On Mon, 2007-11-19 at 00:11 -0600, Larry Garfield wrote: > (Sorry, hit reply too soon.) > > Or, alternatively, you can mostly implement "friend" functions of a sort: > > http://www.garfieldtech.com/blog/php-magic-call > > but they have a performance penalty: > > http://www.garfieldtech.com/blog/magic-benchmarks > > On Sunday 18 November 2007, Sam Barrow wrote: > > What is the general opinion on multiple class inheritance. I have a need > > for it. I have objects for all user input fields. > > > > $username = new field ; > > $username -> name = 'username' ; > > $username -> maxLen = 32 ; > > > > I have three types of fields. Fields that are automatically put in the > > database, such as timestamps, fields that are inputted but not stored, > > such as "confirm password", and fields that are inputted by the user AND > > stored in the database, such as username and password. > > > > Now i have 3 classes: > > > > - abstractField (has methods and properties that apply to all fields). > > - inputField, extends abstractField (has methods and properties for > > display of input form elements and labels). > > - dbField, extends abstractField (has methods for storing and retrieving > > in db, etc.). > > > > However for fields that are inputted AND stored in the db, i need to > > extend both inputField and dbField. > > > > - inputDbField extends inputField, dbField. > > > > Sure, there may be quick hacks to do this, but the only proper way seems > > to be to extend both classes, and I don't want to duplicate any code > > (dbField and inputField are both pretty big, and any modifications will > > also have to be replicated). > > > > And no, I don't want to use interfaces. Interfaces will barely do > > anything for me, I'll still have to duplicate my method bodies, and > > properties. > > > -- > Larry Garfield AIM: LOLG42 > larry@garfieldtech.com ICQ: 6817012 > > "If nature has made any one thing less susceptible than all others of > exclusive property, it is the action of the thinking power called an idea, > which an individual may exclusively possess as long as he keeps it to > himself; but the moment it is divulged, it forces itself into the possession > of every one, and the receiver cannot dispossess himself of it." -- Thomas > Jefferson >