I was under the impression that child class inherit the properties of their parent. The following, however, is output null in class B... Can someone tell me how I access properties from the parent class?
$aClass = new A();
$aClass->init();
class A {
function init()
{
$this->something = 'thing';
echo $this->something; // thing
$bClass = new B();
$bClass->init();
}
}
class B extends A {
function init()
{
echo $this->something; // null - why isn't it "thing"?
}
}