What do members think that this code should do:
class A
{
var $a, $b;
function A($a)
{
$this->$a = $a;
}
function prnt()
{
echo "<br>a=" . $this->$a;
}
}
class B extends A
{
function B($a, $b)
{
parent::A($a);
$this->$b = $b;
}
function prnt()
{
parent::prnt();
echo "<br>b=" . $this->$b;
}
}
$obj = new B("a","b");
$obj->prnt();
I think it should print
a=a
b=b
but it seems to print (on PHP4)
a=
b=
Cheers,
Richard
PS.
In C++ I would be thinking of virtual functions
and in Java I would be thinking of public/protected
properties.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php