
10 Basic concepts
10.5 Member access
10.5.4 Accessibility constraints
Paragraph 11 Several constructs in the C# language require a type to be at least as accessible as a member or another type. 2 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. 3 In other words, T is at least as accessible as M if T is accessible in all contexts in which M is accessible.
Paragraph 21 The following accessibility constraints exist:
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]
| |
| Jagger Software Ltd | |
| Company # 4070126 | |
| VAT # 762 5213 42 |