I want to create multiple global instances of a class. I tried to do this:
for (int x = 0; x <= 10; x++) {
bunny x;
x.create(5, 5);
x.printCreate();
}
(The class name is bunny)
What I tried to do here, was to create an instance named the value that x is at the time, then use the variable x to do functions on the instance with the name the value of x.
But what was brought to my attention was that it just created an instance named num each time, and destroyed it once the loop was over. (I'm pretty new to this, so please bear with me, and the functions I've called from the class have random functions and stuff in them, this fooled me into thinking that it was indeed creating 10 different instances.)
How can I do this, so that 10 global instances are made (so they are not destroyed once the loop is over), and each instance is numbered from 1 - 10. If, like variables, the instance name can't begin with a number, then something like: a1, a2, a3, a4....
This has confused me for so long, Thanks for any help.