tags:

views:

65

answers:

5

What is the default access modifier of a class?

+6  A: 

I believe it's internal.

Ardman
+3  A: 

internal, if defined directly in the namespace (probably most classes):

Internal is the default if no access modifier is specified

For classes within other classes, the default is private, like class members:

The access level for class members and struct members, including nested classes and structs, is private by default.

Source: http://msdn.microsoft.com/en-us/library/ms173121.aspx

Kobi
+1  A: 

Normally, the accessibility of a member is not greater than the accessibility of the type that contains it. However, a public member of an internal class might be accessible from outside the assembly if the member implements interface methods or overrides virtual methods that are defined in a public base class.

When a member of a class is a property, field, method, event, or delegate, and that member either is a type or has a type as a parameter or return value, the accessibility of the member cannot be greater than the type. For example, you cannot have a public method M that returns a class C unless C is also public. Likewise, you cannot have a protected property of type A if A is declared as private.

A: 

by Default Internal is the access modifier of class

Azhar
A: 

internal, except for for nested types in which case it is private

pymendoza