Answer the question
In order to leave comments, you need to log in
Why is the property for the child class model not populated?
abstract class BaseModel
{
public $a;
}
class ModelA extends BaseModel
{
public function __construct()
{
$this->a = 'Тест';
}
}
class ModelB extends BaseModel
{
public function __construct()
{
var_dump($this->a); // null
}
}
abstract class ControllerA
{
private $mObj;
public function __construct()
{
$this->mObj = new ModelA();
}
}
class ControllerB extends ControllerA
{
public function __construct()
{
$mObj = new ModelB();
var_dump($mObj->a); // null
}
}
new ControllerB; // null
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question