Re: Object Context Question in object->object->variable SOLVED
| From: | Sancar Saran | Date: | Mon, 02 Mar 2009 20:35:41 +0000 |
| Subject: | Re: Object Context Question in object->object->variable SOLVED | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289067@lists.php.net to get a copy of this message | ||
On Monday 02 March 2009 20:50:56 Sancar Saran wrote:
> Hello list.
>
> I'm trying to implement someting on OO way.
>
> I got 2 classes
>
> class a {
> var $config = array();
> var $b = '';
>
> function __construct {
> $this->b = new b($this->config);
> }
>
> }
>
> class b {
> var $config = array();
> function foo() {
> switch($this->config['bar']) {
>
> }
> }
> }
>
>
> some where in class a
>
>
>
> and when I call
>
> $bar = new a();
>
> $bar->b->foo();
>
> I got
>
> Fatal error: Using $this when not in object context in
>
> Could you givme some clue what is wrong ?
>
>
> I'm using Ubuntu and PHP 5.2.0-8+etch13
>
> Regards
>
> Sancar
Sorry guys. My Bad
for this kind of operations. method must not be static.
Sancar