For instance...
if I have a module class:
class Module{
var $page;
function Module($page){
$this->page = $page;
}
}
and then the specific class of the news module:
class News extends Module {
function aFunction(){
return $this->page->id;
}
}
Can I create a news as follows:
$page = new Page();
$news = new News($page);
or should I do this:
$page = new Page();
$news = new News();
$news->page = $page;
Thank.
PS: I am completely new to OOP php, so bear with me lol. I switched from procedural php to objective-c and now back to object php .: p It is very difficult to try to compare with each other.
source
share