Here is a simple example:
We can see if we declare c as "int c" rather than "static int c", it can compile. When c is declared as "static int c", it can't compile without "int E::c=0;". Why is that?Code:struct E{
public:
static int c;
E() {c++;}
~E(){c--;}
};
//int E::c=0;
int main(){
E e;
return 0;
}