Dec 17, 2013 at 8:58pm UTC
it seems everytime i use statics in a class i come across with a porblem.
this time i wanted to make a class i created static inside another class.
static fge::window mWinMain;
if someone ever wants to reach it
2 3 4 5 6 7
but when i created some other MainVariables classes at other places instead of them reaching to the same window two window is being created.
yes i know maybe there are better methods but currently i m working on polymorphism and i need some static members. so i need to resolve it to fix my problem.
thx for your helps in advance
pls correct me if i know wrong some stuffs
Last edited on
Dec 17, 2013 at 8:59pm UTC
Dec 17, 2013 at 9:17pm UTC
"but when i created some other MainVariables classes at other places"
This statement seems to imply that your are creating other classes with static variables of the same name. Static variables are only shared across the class your accessing, and defining static variables with similar names in other locations will point to another variable.
Dec 18, 2013 at 12:44pm UTC
ok thx then
i changed the functions to static and call them like which seems like solved the problem. i will test if it did or not.
anyways thx for your helps