什么是最好的方法调用方法heDidIt()从孩子类Make? 我在想事件,但无法找到一个好的非全局解决方案。报告创建者类php
$control = new Control();
$maker = $control->createMaker();
$maker->doIt();
class Control
{
private $_make;
public function createMaker()
{
$this->_make = new Make();
return $this->_make;
}
private function heDidIt()
{
//Call me if the Maker did something.
}
}
class Make
{
public function doIt()
{
//hey im doing something, better tell my Controller
}
}
是的,我会告诉他谁是老板! – bergman