I am creating a program that will make a new object each time I press a certain button. I want to name these objects sequentially and not have to hard code in a certain number of objects. Is there a way in C++ that I can do this?
I want the code to be something like this
if (key == 'n')
{
new Object *shape1*;
}
then next time it runs through that it is
if (key == 'n')
{
new Object *shape2*;
}
then after all objects have been made I want to have a record of the number created (global variable keeping track of count) to be able to print all of these. I haven't used C++ in a year or two so I'm not sure if there is a better way of doing this that I just forgot about or what. If you have a better way of doing this, I am open to any ideas.
Thanks!