Hi

This should do it:

class parentClass {
  var $x;
  var $child;
 
 function parentClass($_x, &$_child) {    //<<<<<<<<<<<<<
    $this->x = $_x;
    $this->child =& $_child;      //<<<<<<<<<<
    $this->child->m = "Grow up, son<br>";
 }
 
 function foo() {
    return "I'm the parent.<br>";
 }
}


class childClass {
 var $m;
 
 function childClass($_m) {
  $this->m = $_m;
 }
 
 function goo(){
  return "I'm the child.<br>";
 }
}


$son = new childClass("I want my mommy<br>");
$dad = new parentClass("I want a new Porche<br>", $son);

echo $dad->child->goo();
echo $dad->child->m;
echo $son->m;





-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to