Re: OOP - transfering object-pointer
| From: | Tularis | Date: | Tue, 19 Nov 2002 09:55:05 +0000 |
| Subject: | Re: OOP - transfering object-pointer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125047@lists.php.net to get a copy of this message | ||
actually, the foreach should read:
foreach($overall->loaded as $key=>$val){
$val =& $overall->$val;
}
still doens't work though
Tularis wrote:
Currently, I have the following code: loaded[] = $class;eval("\$this->$class = new $class;"); return true; }} class foo {var $bar;// Constructor function bar(){ if(!isset($this->bar)){ $this->bar = 1; }else{ $this->bar++; } echo $this->bar."";}} // Start actual loading $overall = new overall; $overall->load('foo'); foreach($overall->loaded as $key=>$val){$key =& $overall->$key;} $overall->foo->bar(); $overall->foo->bar(); $overall->foo->bar(); $overall->foo->bar(); // it doesn't understand this $foo->bar(); // line 42 ?> It all works, except for the $foo->bar(); thing... I am wondering how I can turn $overall->foo->bar() to $foo->bar(); as all the things I've tried, don't work, they don't give any errors, except for Fatal error: Call to a member function on a non-object in d:\apache\htdocs\classes.php on line 42... Could anyone help me with this? thanx - Tularis