Re: Re: PHP OOP
| From: | René Moonen | Date: | Wed, 04 Sep 2002 07:06:41 +0000 |
| Subject: | Re: Re: PHP OOP | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115142@lists.php.net to get a copy of this message | ||
Rodrigo Dominguez wrote:
I made a mistake while I was writting the example, in my original code I wrote it as you did, with $this->b[0] = new one(); but it doesn't work. Thank you. "Philip Hallstrom" <philip@adhesivemedia.com> escribió en el mensaje news:20020903141730.Y54117-100000@cypress.adhesivemedia.com...Eh.. unchecked code, but what about:Not tested, but what if you change$b[0] = new one(); $b[1] = new one();to:$this->b[0] = new one(); $this->b[1] = new one();On Tue, 3 Sep 2002, Rodrigo Dominguez wrote:I have a problem, I can't create an array of classes into a class, for example: class one { var $a; function foo() {echo "foo";} } class two { var $b; function initialize() {$b[0] = new one(); $b[1] = new one();} } $test = new two(); $test->initialize();$test->b[0]->foo(); //It doesn't work $test->b[1]->foo(); //It doesn't workAny suggestion? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
$this->b[0] = new one;
$this->b[1] = new one;
$test = new two;
Instead of
$this->b[0] = new one();
$this->b[1] = new one();
$test = new two();
If no luck try to include error_reporting(E_ALL);
as first line of your script.
Good luck
René