Possible Duplicate:
What are the Default Access Modifiers in C#?
When I define a class
in C#, and don't specify any access modifier which one is the default? Is it public
or protected
?
Possible Duplicate:
What are the Default Access Modifiers in C#?
When I define a class
in C#, and don't specify any access modifier which one is the default? Is it public
or protected
?
In C# if the type is not nested (within other class or struct) and doesn't have access modifier applied it is internal. If it is nested - private.
From C# specification:
3.5.1 Declared accessibility
...
• Types declared in compilation units or namespaces can have public or internal declared accessibility and default to internal declared accessibility.
• Class members can have any of the five kinds of declared accessibility and default to private declared accessibility. (Note that a type declared as a member of a class can have any of the five kinds of declared accessibility, whereas a type declared as a member of a namespace can have only public or internal declared accessibility.)