Static method doesn't allow me to access a global variable?
I can't access the abc variable from static metod which is defined below. why it is not allowed to this? class sample { int abc = 1; void foo1() { abc // accessible } static void foo2() { abc // why not accessible? } }
Roei BarPosted Sep 12, 2009, 11:38 AM
write the abc variable as:
static abc;
and it will be accessible