Hi...
Consider the following code:
-----8<-----8<-----8<-----8<-----
class A
{
var $str_text;
function A()
{
echo "Class A, constructor A";
$this->str_text = "I am in class A";
echo "A: $this->str_text";
}
}
class B extends A
{
var $str_more_text;
function B()
{
echo "Class B, constructor B";
$this->str_more_tex t = "I am in class B";
var_dump($this->str_text);
var_dump($this->str_more_text) ;
}
}
$cls_new = new B;
----->8----->8----->8----->8-----
The constructor for A is not called. Is it possible to call the constructor
of the parent class? I have an extended class that is dependant on data
mined in the parent class's constructor...
Plankmeister.
Consider the following code:
-----8<-----8<-----8<-----8<-----
class A
{
var $str_text;
function A()
{
echo "Class A, constructor A";
$this->str_text = "I am in class A";
echo "A: $this->str_text";
}
}
class B extends A
{
var $str_more_text;
function B()
{
echo "Class B, constructor B";
$this->str_more_tex t = "I am in class B";
var_dump($this->str_text);
var_dump($this->str_more_text) ;
}
}
$cls_new = new B;
----->8----->8----->8----->8-----
The constructor for A is not called. Is it possible to call the constructor
of the parent class? I have an extended class that is dependant on data
mined in the parent class's constructor...
Plankmeister.
Comment