Using Array of classes as a class member variable?
| From: | Martin Stephenson | Date: | Thu, 04 Oct 2001 15:34:10 +0000 |
| Subject: | Using Array of classes as a class member variable? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-69946@lists.php.net to get a copy of this message | ||
Howdy,
First some basic questions:
(1) Can you create an unitialised array ?
(2) Can an unitinialised array be a class member variable ?
My problem is this:
I have a class called "user" - which represents one row in a mySQL table
(also called user)
I want to create a class called "userBag" - this class will contain an
array of "user" classes - the constructor for "userBag" gets an SQL
statement and uses this do decide which users to place in the userBag
Maybe I'm going about this all worng, but is there some other way I can
store a variable number of classes (Such as a CObject class in MFC for
Visual C++) - i.e. is there soem other collection class/type I don't know
of ?
Thanks,
Martin.