ECMA-334 C# Language Specification

10.5.4: Accessibility constraints

Several constructs in the C# language require a type to be at least as accessible as a member or another type. A type T is said to be at least as accessible as a member or type M if the accessibility domain of T is a superset of the accessibility domain of M. In other words, T is at least as accessible as M if T is accessible in all contexts in which M is accessible.

The following accessibility constraints exist:

[Example: In the example
class A {...}  
public class B: A {...}  
the B class results in a compile-time error because A is not at least as accessible as B. end example]

[Example: Likewise, in the example
class A {...}  
public class B  
{  
   A F() {...}  
   internal A G() {...}  
   public A H() {...}  
}  
the H method in B results in a compile-time error because the return type A is not at least as accessible as the method. end example]