Hi, I have this code:

<?php
error_reporting(E_ALL);

class esempio {
    var $pubblica;
    private $privata = "Io sono privata";
    var $protetta = "Io sono protetta";

    /*function esempio()
    {
        echo "sono in esempio::esempio()<br>\n";
    }
    */
    function __construct()
    {
        echo "sono in esempio::__construct()<br>\n";
        $this->protetta = "I'm protect";
    }

    function exe()
    {
        echo "sono in exe()<br>\n";
        echo $this->protetta;
    }

}

class exe extends esempio {

    function __construct()
    {
        echo "sono in exe::__construct()<br>\n";
    }

    function exe()
    {
        echo "sono in exe::exe()<br>\n";
    }
    function ex2()
    {
        echo "sono in exe2()<br>\n";
        echo "\$protetta: ".$this->protetta."<br>\n";
        $this->exe();
    }
}

$n = new exe;
$n->ex2();

?>

This is the output:

sono in exe::exe()
sono in exe2()
$protetta: 
sono in exe::exe()

Why not __construct() of esempio class is called?

If I have two construct (__construct() and exe() ) is ok that exe() is
called and not __construct() (of class "exe") ???

I'm using php5-cvs of 19 Feb 2003.

Tnx in advance.

-- 
michel 'ziobudda' morelli <[EMAIL PROTECTED]>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to