For each 'item' on the screen, I want to store its data in variables within a class. All 'items' have the same variables, so I want to create an object (of the 'item's class) for each 'item' on the screen, and adjust the variables of each individual 'item' (i.e. variable "x_position", of object "ship1", of class "frieghter"... Though the class probably won't be that specific unless it's through inheritence).
The problem is, I want to be able to delete and create these objects on run-time. I could create these as 'static' object arrays in the memory prior to their actual use in the game, but aside from limiting the number of 'items' I can have thoughout the game (unless I declared more arrays, which would require memory even after the destruction of the 'item'... Another memory draw-back), it would require more memory for 'items' not even present in the context of the game.
So I was wondering how I could create object arrays (or just objects), that I could delete individually, while maintaining numerical order (like lists, vectors, and maps).
In other words, referring to my previous 'example', create class "ships", with child-class "frieghter", and then create "ship1, ship2, ship3... ship'n'", and then be able to delete those individually (and free the memory used by them). Or, more simply, is there any way I can use a variable to name an object of class?