instantiating a class
| From: | Remco Chang | Date: | Thu, 14 Sep 2000 20:50:37 +0000 |
| Subject: | instantiating a class | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16834@lists.php.net to get a copy of this message | ||
i think i have hit a bug in PHP regarding instantiating multiple objects
from within a class.
has anyone tried this:
class MyClass {
var $obj1;
var $obj2;
function MyClass {
$this->$obj1 = new SomeClass();
$this->$obj2 = new SomeOtherClass();
$this->$obj1->doSomeStuff();
$this->$obj2->doSomeOtherStuff();
}
}
this does not work for me.... PHP complains that it does not know what
doSomeStuff() is (even though it's there). the kicker is that if you swap
the lines withere you instantiate the classes, it stops complaining about
doSomeStuff() and starts complaining about doSomeOtherStuff().
basically, what i came to understand is that PHP only allows one
instantiation of classes. it does not do well with more than one. lemme
know if this is a "feature" or a bug... if it's a bug, i'll submit a bug
report.
----------------
remco chang
bountyquest.com