Hey,
I have two separate objects, a main and a "child". Its physically not a real child object, because I add the whole parent through the constructor to the child.
Like this:
class core
{
public function __get($class)
{
$this->load($class);
}
public function load($class, $file = null, $lib = true)
{
if($file == null)
$file = $class;
if($lib == true)
include(LIBPATH.$file.PHP);
else
include(SYSPATH.$file.PHP);
$this->$class = new $class($this);
}
}
And the "child":
class Child implements myStruct
{
public function __construct($obj)
{
$this->obj =& $obj;
}
}
Is this as ugly as i think, or is this solution acceptable?