call_user_func(array($this, $method), $par) from parent's constructor?

AddindCiste

New Member
\[code\]class Parent{ public function __construct($method) { call_user_func(array($this, $method), 1); }}class Child extends Parent{ public function __construct($method) { parent::__construct($method); } protected function call_me_on_construct($par) { echo $par; }}\[/code\]Creating instance of \[code\]$child = new Child("call_me_on_construct");\[/code\]I want \[code\]call_me_on_construct\[/code\] method to be called. The problem is Parent's constructor know nothing about \[code\]$this\[/code\]. What is better way to do it?Thank you.
 
Back
Top