Hi,
If I have a class that defines another class, how do i access the sub one from the main code.
So I have something like:
<?
But how would the main code go to access the ID property of B when an A has been defined... i.e. not like this:
how should it look?
thanks
Andy
If I have a class that defines another class, how do i access the sub one from the main code.
So I have something like:
<?
Code:
class A{
function A($foo){
$this->p = new B($foo);
}
}
class B{
function Z($myvar){
$this->ID= $myvar;
}
}
?>
Code:
$newvar = new A(666); echo "B=".$newvar->p->ID;
thanks
Andy
Comment