From within the class, how do I access a static variable explicitly? (Is the best practice to access static variable explicitly eg. using static.staticVar)
The below works
class Something {
protected static _var1;
public void somefunc() {
return _var1;
}
}
But how do i specify it explicitly? (Is specifying explicitly recommended?)
I suggest you do what is the simplest and clearest code you can. It a judgement call most of the time and if you are working with people you can ask them.
I avoid using a mutable static field if at all possible. However, in this case you can write