Create objects unsing for

How do I create objects from a class, using a for, like:


Let's say I want to create object1, object2, object3, object4,...,objectN

How do I proceed?


Thanks!
You can crate an array or <vector> or <list> or any other container of objects.

With the array you can refer to the objects as Object[0] to Object[N-1] if it was declared with N values. You can something similar with vectors. Use the for loop to initialise and access the values.

HTH
Topic archived. No new replies allowed.