I have a static variable in the class. I am Initializing that in the global scope, its works fine.
But When I try to Initialize in the main linker throws an error. Why it so.
class Myclass{
static int iCount;
} ;
int main(){
int Myclass::iCount=1;
}
And In global scope why I have to specify the variable type like
int Myclass::iCount=1;
As In my class I am definig iCount as integer type why not.
Myclass::iCount =1 ; in //Global scope