Calling a class member...

From: Date: Thu, 17 Aug 2000 10:30:31 +0000
Subject: Calling a class member...
Groups: php.general 
Request: Send a blank email to php-general+get-12197@lists.php.net to get a copy of this message
Hello ! Imagin the following: class A { function A() {} function DoA() { [DoSomething]; } } class B { var $instance_a; function B() { $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) How is it correct ? (Please don't tell me to extend class B with A...) Regards Martin

« previous php.general (#12197) next »