Now let's say we want to keep Frank's information, but add information for George. First, we'll move our Frank object to a new, more generic, variable name:
global People = Frank
This sets the variable People to our already instantiated object. This does not make a copy of Frank, but simply creates another reference to the same object. So if you did:
People.name = "Frank Jones"
? Frank.name
you would get "Frank Jones". Changing People.name also changes Frank.name because the refer to the same object. Now that People refers to our object, we can set Frank equal to something else, say Frank = 0, to remove this reference. If we remove all references to our object, DAQFactory will automatically delete the object. But now we are going to add another Person object to our list of People:
People[1] = new(Person)
People[1].name = "George Johnson"
People[1].address = "123 Charles St"
People[1].zip = "54321"
Here we created a new instance of the Person class and put it in the second array element of Person. The first array element, [0], still contains the object with Frank's information. We then set all the member variables for our new object. You can see from this example, then, how to create array's of objects and access their members. Note that Person doesn't have to have the same object, but could containing different class types. This could then be used to implement polymorphism, though remember that DAQFactory doesn't have any strict type casting and so if you want to implement polymorphism you'll need to make sure that all the objects have the same base parent class, or at least the same member names.
Now, technically, the member variables of Person are actually arrays, so we could have implemented this as arrays within a single object:
People = new(Person)
People.name = {"Frank Smith","George Johnson"}
People.address = {"123 Main St","123 Charles St"}
People.zip = {"12345","54321"}
Referencing these internal array elements is simply a matter of placement of the subsetting:
? People.name[1] will display "George Johnson"
The real flexibility comes when you do both. So, you could have one instance of the class Person that contains all the people that live on Main or Charles street and store that in People[0], and then a second instance of all the people that live on York Rd and store that in People[1], etc. If you really wanted to get complex, you can of course store object references in member variables of other objects!