note 9419 added to Classes and Objects

From: Date: Thu, 02 Nov 2000 11:34:55 +0000
Subject: note 9419 added to Classes and Objects
Groups: php.notes 
Request: Send a blank email to php-notes+get-7292@lists.php.net to get a copy of this message
Overloading of the constructor of a class... is it possible? (it would be very helpfull indeed) as far as I've noticed, it isn't. -------------------------------- class foo { var $a; var $b; // default constructor function foo () { $this->a = 'default'; $this->b = 'default'; } // copy constructor function foo($otherfoo) { $this->a = $otherfoo->a; $this->b = $otherfoo->b; } // init constructor function foo ($_a, $_b) { $this->a = $_a; $this->b = $_b; } } Oh how I miss C++.... *grin* does anyone have a workaround, or is this just something php is missing? http://www.php.net/manual/language.oop.php

« previous php.notes (#7292) next »