title: Error: Inaccessible due to its protection level
body: <p>This is an example from MSDN which is from the portion explaining 'protected'member access modifier. My question is, why I am getting compile error, if I  modifying this program like in Example II,</p>
  
  <p><strong>Example I</strong></p>
  
  <pre><code>class A
  {
      protected int x = 123;
  }
  
  class B : A
  {
      static void Main()
      {
          A a = new A();
          B b = new B();
  
          b.x = 10;
      }
  }
  </code></pre>
  
  <p><strong>Example II</strong></p>
  
  <pre><code>class A
  {
      protected int x = 123;
  }
  
  //MODIFICATION IN BELOW 2 LINES
  class B : A{}
  class program
  {
      static void Main()
      {
          A a = new A();
          B b = new B();
  
          b.x = 10;
      }
  }
  </code></pre>
  
  <p><strong>Compiler Error for Example II :</strong></p>
  
  <pre><code>d:\MyProgs&gt;csc _13protected.cs
  Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
  Copyright (C) Microsoft Corporation. All rights reserved.
  
  _13protected.cs(14,15): error CS0122: 'A.x' is inaccessible due to its
          protection level
  _13protected.cs(3,23): (Location of symbol related to previous error)
  
  d:\MyProgs&gt;
  </code></pre>