no construct called
| From: | michel 'ziobudda' morelli | Date: | Sat, 22 Feb 2003 13:57:50 +0000 |
| Subject: | no construct called | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-94451@lists.php.net to get a copy of this message | ||
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 <michel@ziobudda.net>