note 9419 rejected and deleted from Classes and Objects by ronabop
| From: | ronabop@php.net | Date: | Fri, 03 Nov 2000 03:55:54 +0000 |
| Subject: | note 9419 rejected and deleted from Classes and Objects by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7319@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?