View Single Post
Old 02-04-2009, 10:22 AM   #4 (permalink)
Jenski
The Wanderer
 
Join Date: Apr 2008
Location: Cloud 9
Posts: 19
Thanks: 0
Jenski is on a distinguished road
Default

Quote:
Originally Posted by Tanax View Post

Or you could design it to be added in the __construct function so you would simply use this:
PHP Code:
$b = new classB();
$d = new classD($b); 
And to use the class b functions inside your class d, you just do like this:
PHP Code:
$result $this->classB->function($args); 
Could you create it in the __construct function? Instead of passing, or would that not work? e.g.

PHP Code:
class classD
{
private 
$classB;

public function 
__construct()
{
require_once(
'/path/to/classB/file');
$this->classB = new classB;
}  

$d = new classD(); 
Jenski is offline  
Reply With Quote