c# - Declaring private variable inside Main -
class program { static void main(string[] args) { private int panda=3; } }
compiler spits 4 errors when this. declaring private variable in main forbidden? why?
variables declared inside block (i.e. code between 2 curly braces) visible inside block, there no sense in declaring them private, public or protected.
class { private static int x=0;//make sense static void main(string[] args) { private static int x=0; //does not make sense } }
Comments
Post a Comment