Dynamic instantiation of classes
Posted on 2000-04-08
I have a certain class defined. Let's say:
constructor create(const a: integer);
During runtime I need to create instances of that class, yet I cannot know until rutime how many objects will be required (of course, for each instance of the class, the constructor should be called).
What would be the best way to create instances of this class in runtime and manage a list of all the object I have created from that class so I can access their methods etc.?
Note that instances of this class shoukd be created from within a function yet remain viable after the function exits because other functions should use those objects.