How to access parent's class property if the current class has been instantiated in the parent
问题 I'm experimenting with MVC trying to make a simple framework. This is an example of what I'm doing: <?php require_once('config.php'); //Here I have the Config object class App{ protected $config; protected $controller; public function init(){ $this->config = new Config; $this->controller = new Main_Controller; } } class Main_Controller extends App{ public function __construct(){ var_dump($this->config); } } $app = new App; $app->init(); The problem is that my var_dump is returning NULL, so