note 31964 deleted from ref.classobj by victor
| From: | victor@php.net | Date: | Fri, 19 Aug 2005 19:48:32 +0000 |
| Subject: | note 31964 deleted from ref.classobj by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-93920@lists.php.net to get a copy of this message | ||
Note Submitter: ninja (a : t) thinkninja (d : o : t) com
----
the best way i found to call an instance of a class from within another class is like so:
class foo {
var $meta = 1;
}
class bar {
var $foo;
function bar(&$objref) //constructor
{
$this->foo =& $objref;
}
function doohickey()
{
return $this->foo->meta;
}
}
$fooclass = new foo();
$barclass = new bar($fooclass);
echo $barclass->doohickey();