Greetings, I'm wondering if there's any way to process variables similarly to arrays in this manner?
Looking for a solution to output objects and we haven't covered vectors yet.
int var1 = 0, var2 = 0, var3 = 0;
for (int x = 0; x < 4; x++)
var(x) = 1;
What you're looking for is arrays.
Originally Posted by Iron Lion
I need to process objects so I don't think arrays really work here.
Originally Posted by dutchgold92
Nope, there's no way to do what you're describing. Identifiers such as 'var1' don't exist during runtime, so you can't manipulate them with your program. There's nothing to stop you having an array of objects, though, or some other collection.
Make object arrays.
ClassName objectArray = new ClassName;
Using a Map of some sort possibly?
We don't really have enough information on what you are trying to achieve to say.