I am working with code that has a global static variable (which is an object) and I need access to it from another class. I have always avoided global variables / functions in general, so in this situation I'm not sure how to do this correctly.
Just to clear my understanding of things, there is an internal connection in the global static variable, which means that any source file that includes this particular header will get its own copy of the variable?
EDIT: What I have tried so far is to make a function that returns the address of a variable. Unfortunately this does not work.
// names were changed but the code is as follows. // There is of course other code in the header namespace SomeNameSpace { static anArray<someObject> variable; }
NOTE. I canβt change the code in the header where the global static variable is declared. I can add functions, but I should try to avoid this if I can.
Samaursa
source share