Hey everyone,

I've read a bit on this forum about global variables and see that you don't recommend em.

I want to be able to use a vector of Fish objects in a boids algorithm. Here's the declaration of the vector in main.cpp:
Code:
static vector<Fish*> fishVector;
If I need to send it to boids.cpp where it's needed, then I need to give it to every fish object as a parameter on creation, which then needs to give it to the boids algorithm as parameter when calling its functions.
So the fishVector will be sent like this: main.cpp -> fish.cpp -> boids.cpp.. This annoys me since fish.cpp has nothing to do with the fishVector vector at all.

Are there another way to get it to boids.cpp without having to send it though fish.cpp and without using global variables??

If you have any question or something that needs clarification, please write

Thanks in advance.
Mipzhap