class Master{ protected static $DB; function __construct(){ static::$DB = new DB(); $view = new View(); } } class DB extends Master{ private function ReturnSomeData(){ return $data; } } class View extends Master{ public function ViewData(){ $DBdata = static::$DB->ReturnSomeData(); } } Fatal error: Call to private method DB::ReturnSomeData() from context 'View'
How can I access the ReturnSomeData() method from the View class? Is there something like a 'gateway'?
class Master { ... } class DB extends Master{ ... public function PassItToMe(){ return $this; } } class View extends Master{ public function ViewData(){ $DBdata = static::$DB->PassItToMe()->ReturnSomeData(); } } This is my picture right now, but I'm really lost. The idea is that I want to access private methods from one child class to another.