Re: Class/Objects
| From: | Michael Davey | Date: | Fri, 31 May 2002 16:16:03 +0000 |
| Subject: | Re: Class/Objects | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100115@lists.php.net to get a copy of this message | ||
I believe so - but why are you passing a the object a reference to itself?
> $bar->db_obj->run_some_code($bar);
> $bar->tpl_obj->do_this_for_me($bar);
If you need to access parts of the object from within, use the $this->
pointer.
> It works but was wondering if its 'legal' to use it like this ->
> $lcre->db_obj->run_some_code($bar);
> $lcre->tpl_obj->do_this_for_me($bar);
This looks like it makes more sense as you are passing a reference to $bar
into $lcre - as long as your function is setup to accept this type of object
and knows what to do with it.
Mikey