Posted by Greg Donald on 07/11/05 18:04
On 7/11/05, Alessandro Rosa <zandor_zz@yahoo.it> wrote:
> Is there the possibility to have in PHP multiple class constructors
> as in C++ or just one ?
Doesn't seem as though you can:
> cat class.php
#!/usr/bin/php
<?php
error_reporting( E_ALL );
class Foo
{
function __construct()
{
}
function __construct()
{
}
}
$f = new Foo;
?>
> ./class.php
PHP Fatal error: Cannot redeclare __construct() in
/home/greg/class.php on line 13
Fatal error: Cannot redeclare __construct() in /home/greg/class.php on line 13
--
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/
Navigation:
[Reply to this message]
|