Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10357 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95081 invoked by uid 1010); 9 Jun 2004 22:43:09 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 95018 invoked from network); 9 Jun 2004 22:43:08 -0000 Received: from unknown (HELO hermes.sunderland.ac.uk) (157.228.37.117) by pb1.pair.com with SMTP; 9 Jun 2004 22:43:08 -0000 Received: from steph2 ([157.228.147.166]) by hermes.sunderland.ac.uk (iPlanet Messaging Server 5.2 Patch 1 (built Aug 19 2002)) with ESMTP id <0HZ200B6FCI7YD@hermes.sunderland.ac.uk> for internals@lists.php.net; Wed, 09 Jun 2004 23:44:31 +0100 (BST) Date: Thu, 10 Jun 2004 00:05:31 +0100 To: internals Reply-to: steph@zend.com Message-ID: MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Content-type: text/plain; charset=Windows-1252 Content-transfer-encoding: 7BIT Importance: Normal X-Priority: 3 (Normal) X-MSMail-priority: Normal Subject: a very boring question about objects, and what's expected of them From: steph@zend.com (Steph) Good people, consider this, and tell me what's right and what's wrong: name = $param2."\n"; print($this->name); } } class sonOfBlah extends blah { function __construct($param) { // overwriting the constructor is allowed $this->name = $param."\n"; print($this->name); // property read/write is enabled } } /* ext/mysqli behaviour */ class DB extends mysqli { function __construct() { /* Need to call parent constructor to even overwrite $host in the constructor. If there is a constructor, need to call parent constructor to provide property access (internal or external) */ parent::__construct('localhost', 'root', ''); print($this->thread_id)."\n"; } } class secondDB extends mysqli { /* if there is no constructor, all seems well with direct inheritance (only) */ } new blah('blah - first param', 'blah - second param'); new sonOfBlah('sonOfBlah - first and only param'); $db = new DB(); $db2 = new secondDB('localhost', 'root', ''); print($db2->thread_id); ?> Who's right, who's wrong, where are the weaknesses? - Discuss.. - Steph