2 <clause number="17.2.6.5" title="Access to private and protected members of the containing type">
3 <paragraph>A nested type has access to all of the members that are accessible to its containing type, including members of the containing type that have private and protected declared accessibility. <example>[Example: The example <code_example><![CDATA[
7 private static void F() {
8 Console.WriteLine("C.F");
12 public static void G() {
23 ]]></code_example>shows a class C that contains a nested class Nested. Within Nested, themethod G calls the static method F defined in C, and F has private declared accessibility. end example]</example> </paragraph>
24 <paragraph>A nested type also may access protected members defined in a base type of its containing type. <example>[Example: In the example <code_example><![CDATA[
29 Console.WriteLine("Base.F");
37 Derived d = new Derived();
45 Derived.Nested n = new Derived.Nested();
49 ]]></code_example>the nested class Derived.Nested accesses the protected method F defined in Derived's base class, Base, by calling through an instance of Derived. end example]</example> </paragraph>