Oftentimes in a program I am going to write, a user’s action is used to create a new instance of a class. I don’t know how many instances I will need, so how can I create instances at runtime and have a way to access each one individually? I have searched the forums, but I can’t understand any of the answers that have been given (I am still new to C++)
Share
You can create an array (or vector) of classes, add any number of object instances to it, and access them using
[]operator