constructor in php4?
| From: | bob | Date: | Sun, 21 Apr 2002 07:06:30 +0000 |
| Subject: | constructor in php4? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-93870@lists.php.net to get a copy of this message | ||
the manual says:the function A will be called.
in fact, the function B is called.
why?
my config : win98/pws2/php411(CGI)
<?php
class A
{
function A()
{
echo "I am the constructor of A.<br>\n";
}
function B()
{
echo "I am a regular function named B in class A.<br>\n";
echo "I am not a constructor in A.<br>\n";
}
}
class B extends A
{
function C()
{
echo "I am a regular function.<br>\n";
}
}
// This will call B() as a constructor.
$b = new B;
?>
thaks