How do I add a row to an array of an unknown class?

I have a routine, GetClass, that converts a properly formatted array of strings in the form ‘name = value’ into a class object and populates the class with the value for each name.

For example, a disk file might read:

WindowCount = 3 WindowBorder = Blue WindowVisible = False

My routine will load this file from disk, and populate an instance of a class with the properties WindowCount, WindowBorder, and WindowVisible.

So far so good.

Now I want to create an array of class objects. The routine is something like this:

Boolean GetClassArray (pList() As String, pClass() as Object)

Somewhere in this routine, I want to add a new row to the array pClass. Normally I would do this by:

DIM NewClassElement AS NEW ClassType pClass.AddRow (NewClassElement)

But in this case, I do not know the class (ClassType) of pClass, which is a parameter passed to this routine. How do I accomplish this?

If all the class types inherit from the same base class, you can declare the array as the base class type.

Function GetClassArray (pList() As String, pClass() as BASEClassType) As Boolean DIM NewClassElement AS BASEClassType = NEW SUBClassType pClass.AddRow (NewClassElement)

Or use a dictionary / pairs

if u use pClass() as Object
you can add any class object into but if you need it again from the list
u need to cast it back to access the properties and methods.

u said u created an instance of a class