Re: instantiating a class

From: Date: Thu, 14 Sep 2000 22:03:01 +0000
Subject: Re: instantiating a class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16842@lists.php.net to get a copy of this message
Don't you need to get rid of the $ in front of the vars? function MyClass { $this->obj1 = new SomeClass(); $this->obj2 = new SomeOtherClass(); $this->obj1->doSomeStuff(); $this->obj2->doSomeOtherStuff(); } Charles ----- Original Message ----- Sent: Thursday, September 14, 2000 1:50 PM Subject: [PHP] instantiating a class 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#16842) next »