PHP sınıflar içinde Sınıfları

0 Cevap php

PHP yapabilirsiniz? Ben çelişkili görüşler duydum:

Gibi bir şey:

Class bar {
   function a_function () { echo "hi!"; }
}

Class foo {
   public $bar;
   function __construct() {
       $this->bar = new bar();
   }
}
$x = new foo();
$x->bar->a_function();

Will bu echo "merhaba!" ya da değil?

0 Cevap