Add a more functional (i.e. fewer-stubs) implementation of System.Data.Linq.
[mono.git] / mcs / docs / ecma334 / 17.2.6.5.xml
1 <?xml version="1.0"?>
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[
4 using System;  
5 class C   
6 {  
7    private static void F() {  
8       Console.WriteLine("C.F");  
9    }  
10    public class Nested   
11    {  
12       public static void G() {  
13          F();  
14       }  
15    }  
16 }  
17 class Test   
18 {  
19    static void Main() {  
20       C.Nested.G();  
21    }  
22 }  
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[
25 using System;  
26 class Base   
27 {  
28    protected void F() {  
29       Console.WriteLine("Base.F");  
30    }  
31 }  
32 class Derived: Base   
33 {  
34    public class Nested   
35    {  
36       public void G() {  
37          Derived d = new Derived();  
38          d.F();    // ok  
39       }  
40    }  
41 }  
42 class Test   
43 {  
44    static void Main() {  
45       Derived.Nested n = new Derived.Nested();  
46       n.G();  
47    }  
48 }  
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>
50 </clause>