Pointers vs references for class objects

Pages: 1234
Oh oops, I meant to pass by reference but I forgot to put that there, Fixed it. But if I create all those enemies, and need them in different functions, do I have to use an array or vector or some other container to use them all or is there an easier way?
One of the main purposes of a container is that is is the easy way to pass around a whole load of objects (of the same type) at once!

What easier way were you imagining? Something that magically operates on every object of a certain type that's been instantiated anywhere in your code? No, that doesn't happen.
I was just wondering if that was the best way to do it, it seems like it is but i've been surprised before, I would do something and think it was the best solution and then someone would give me a better one. If thats the easiest way then thats fine, just curious.
Topic archived. No new replies allowed.
Pages: 1234