This is a discussion on Global variable vs parameter 'sending'. within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by MipZhaP The main.cpp file is responsible for creating (using OpenGL - you don't need to care about ...
I suggest you post the files you use (both .h and .cpp) with just the declaration of the classes (excluding anything between brackets).Another solution is to (from main.cpp) give a pointer to the list as a parameter to every fish so they can have a reference to it and then give that reference to the boids.cpp algorithm when it needs to use it. But this is stupid since the refence needs to go through fish.cpp - which really doesn't need that reference for itself at all.
This way you can get a better advice, since there are two separate issues.
1) The class design
2) The linkage of the file
These are not necessarily linked together