Re: constructors in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/11/05, Alessandro Rosa <zandor_zz@xxxxxxxx> 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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux