Probuje zrozumiec wzorczec mvc zawarty tutaj :
Wzorzec MVC
Ale wystrpuje tutaj niezrozumialy dla mnie sposob instancjacji obiektu klasy , mianowicie :
W przykladzie w linku wyzej mamy zdefiniowana klase DataAccess, tutaj wszystko zrozumialem.
Ale nastepnie w klasie ProductModel mamy cos takiego :
<?php class ProductModel { /** * Private * $dao an instance of the DataAccess class */ var $dao; //! A constructor. /** * Constucts a new ProductModel object * @param $dbobject an instance of the DataAccess class */ function ProductModel (&$dao) { $this->dao=& $dao; ?>
Jakim cudem parametr $dao jest instancja klasy DataAccess ? tak jak to jest napisane tutaj w komentarzu.
Tak samo dalej taki sam przypadek dla klasy ProductView:
<?php class ProductView { /** * Private * $model an instance of the ProductModel class */ var $model; /** * Private * $output rendered HTML is stored here for display */ var $output; //! A constructor. /** * Constucts a new ProductView object * @param $model an instance of the ProductModel class */ function ProductView (&$model) { $this->model=& $model; } ?>
Jak widzimy tutaj $model jest instancja klasy ProductModel.
Zupelnie tego nie rozumiem.