title: accessibility propagation of nested types/type members
body: <p>In my understanding, if we have some type <code>T1</code> and a nested type <code>T2</code> (or a member <code>M2</code>) inside <code>T1</code>, the accessibility of <code>T2</code> (<code>M2</code>) is the minimum of the accessibility of <code>T1</code> and <code>T2</code>.</p>
  
  <p>By minimum I mean the accessibility I would get by searching the two accessibility levels in the below schema and taking the one that is lower:</p>
  
  <pre><code>public
  |
  protected internal
  |            |
  internal     protected
         |     |
   (protected AND internal)*
               |
               private
  </code></pre>
  
  <p>(* This is not definable directly by an access modifier. It only allows access from inherited types defined inside the assembly.)</p>
  
  <p>Example:</p>
  
  <pre><code>internal class T1
  // internal
  {
      public int i;
      // internal
  
      protected class T2
      // protected and internal
      {
          public int j;
          // protected and internal
      }
  }
  </code></pre>
  
  <p><strong>Is that correct? If not, what are exceptions to this rule?</strong></p>
  
  <p>I'm asking because in the book "Programming in C#: Exam Ref 70-483" by Wouter de Kort there is written:</p>
  
  <blockquote>
    <p>Something to keep in mind is that the access modifier of the enclosing
    type is always taken into account. For example, a public method inside
    an internal class has an accessibility of internal. <em>There are
    exceptions to this (for example, when an internal class implements a
    public interface or when a class overrides a public virtual member of
    a base class)</em>, so you need to keep track of those things when
    determining the accessibility of a type you need.</p>
  </blockquote>
  
  <p>But there is no further explanation of what that means, and I don't get it.</p>
  
  <ol>
  <li><p>If an internal class implements a public interface, this class can only be used inside the assembly. So how can the implemented interface methods be more accessible than internal? Does it have something to do with static methods?</p></li>
  <li><p>If a child class overrides a public method of a base class, the child can only be accessed in its specified level. So how can the overridden method be more accessible if the child is not? Does it have something to do with static methods?</p></li>
  </ol>