Because in every object there will be a vector of CEntity's created? Or will it not because it is static? And why do I need to type it again in the cpp file?
In the .h file.
1 2 3 4 5 6 7
class CEntity
{
public:
static std::vector<CEntity*> EntityList;
...
Ok, but when I want to use the vector do I just type CEntity::EntityList or does all the different objects I make of CEntity have a vector for themselfs?
That vector stores pointers, not CEntity objects. That alone prevents recursion.
It is static, so there is only one vector.
ODR -- One Definition Rule. The constructor of the static vector must be called exactly once within the binary. The line in .cpp generates that call to constructor.