Home   Cover Cover Cover Cover
 

Declarations using the same name

Using the same name for a class, a method and a local variable is allowed, because a name that is declared in an inner declaration space does not clash with the same name in the outer declaration space (except in inner statement blocks). The class name X belongs to the declaration space of the namespace, the method name X belongs to the declaration space of the class, and the variable name X belongs to the declaration space of the method. X is declared only once in each declaration space, so everything is ok.