Exemplo n.º 1
0
        echo 'This is Y' . '<br>';
    }
}
class Z
{
    public $ob;
    public function get_ob(X $var)
    {
        $this->ob = $var;
    }
    public function get_result()
    {
        echo $this->ob->get();
    }
}
$x = new X();
$y = new Y();
$x->render();
$y->render();
$z = new Z();
$z->get_ob($x);
$z->get_ob($y);
$z->get_result();
$poly = new Poly();
$page = new Page('Page', 'hello i am page', 'footer');
echo $page->render_body();
$index = new Index('Index', 'hello i am index', 'footer', 'slideshow', 'news');
echo $index->render_body();
$poly->get_ob($page);
$poly->get_ob($index);
$poly->get_result();