title: Compiler inconsistent accessibility error with passing nested class as a function parameter
body: <p>My visual studio 2010 finds  inconsistent accessibility of parameter type error when I compile this C# code:</p>
  
  <pre><code>class Program
  {
      class BaseClass
      {
          public class NestedClass
          {
  
          }
      }
  
      public static bool Function1(BaseClass.NestedClass obj)
      {
          return true;
      }
  
      static void Main(string[] args)
      {
          Function1(new BaseClass.NestedClass());
          new BaseClass.NestedClass();
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>but when I comment function1 it works.</p>
  
  <pre><code>class Program
  {
      class BaseClass
      {
          public class NestedClass
          {
  
          }
      }
  
      //public static bool Function1(BaseClass.NestedClass obj)
      //{
      //    return true;
      //}
  
      static void Main(string[] args)
      {
          //Function1(new BaseClass.NestedClass());
          new BaseClass.NestedClass();
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>Why NestedClass can be created but can't be parameter?</p>
  
  <p>EDIT: Sorry, I wasn't quite precise with my question. Above I tried to recreate problem in Console application, but in my project I have other structure of classes:</p>
  
  <pre><code>         class BaseClass
              {
                 public class NestedClass
                  {
  
                  }
              }
  
      public class OtherClass
      {
            public void Function1(BaseClass.NestedClass param)    
                  {
                    var newObj = new BaseClass.NestedClass();
                  }
      }
  </code></pre>
  
  <p>PS: Setting BaseClass to public really solved my problem. Now, thanks to answers and comments, I understand that it's because public Function1 has greater accessibility than internal (by default) BaseClass. But I don't understand why I can create new NestedClass objects without error?</p>