Re: Calling a class member...
| From: | Robin Vickery | Date: | Thu, 17 Aug 2000 10:40:13 +0000 |
| Subject: | Re: Calling a class member... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-12198@lists.php.net to get a copy of this message | ||
martin@thomatechnik.de (Martin) writes:
> Hello !
>
> Imagin the following:
>
> class A
> { function A()
> {}
>
> function DoA()
> { [DoSomething];
> }
> }
>
> class B
> { var $instance_a;
> function B()
> { $instance_a = new A();
Change this to:
$this->instance_a = new A();
> }
>
> function DoB()
> { $this->instance_a->DoA(); // <<<< Here ist the problem
> }
> }
>
> I want to call DoA of instance_a in class B. But the parser tells me:
> Fatal error: Call to a member function on a non-object in ... (DoB)
--
Robin Vickery...............................................
Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK
Email: robin@planet-three.net Phone: +44 (0)794 670 6395