i've got a problem dealing with static private variables. Here is my code.
ClassA.h:
class ClassA{
static int a;
public:
int getA();
};
Class.cpp:
#include "ClassA.h"
int ClassA::a = 9001;
int ClassA::getA(){
return a; //<--- Undefined reference to ClassA::a
}
As you can see, i defined the static variable in the implementation file, as it has been said over and over, i also did this to other static member of other classes, and they work without any problem, but this one doesn't. Does anyone have any solutions?