title: Inconsistent accessibility: return type is less accessible than method C#
body: <p>Ok, so this is really wierd. I have a private member, and I want to use it into Form2. I've made a public static method, so that I can get that member into Form2.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>private static AppController appController;
  private BreadRepository breadRep;
  private CakeRepository cakeRep;
  private SandwichRepository sandwichRep;
  
  public Form1()
  {
      InitializeComponent();
  
      breadRep = new BreadRepository();
      cakeRep = new CakeRepository();
      sandwichRep = new SandwichRepository();
      appController = new AppController(breadRep , sandwichRep, cakeRep);
  }
  public static AppController getController()
  {
      return appController;
  }
  </code></pre>
  
  <p>I've tried to make the appController from Form1 public, but I get even more errors. Right now I get this:</p>
  
  <blockquote>
    <p>Inconsistent accessibility: return type 'exemplu_map.controller.AppController' is less accessible than method 'exemplu_map.Form1.getController()'
    Any ideas ?</p>
  </blockquote>
  
  <p><strong>Update:</strong></p>
  
  <p>Here is my AppController class:</p>
  
  <pre><code>class AppController
  {
      private BreadRepository breadRep;
      private SandwichRepository sandwichRep;
      private CakeRepository cakeRep;
      public AppController(BreadRepository breadRep, SandwichRepository sandwichRep, CakeRepository cakeRep)
      {
          this.breadRep = breadRep;
          this.sandwichRep = sandwichRep;
          this.cakeRep = cakeRep;
      }
  
      public void writeToFile(String file)
      {
          StreamWriter wr = new StreamWriter(file);
          String writeMe = "";
          foreach(Bread e in breadRep.getAll())
          {
              writeMe = writeMe + e.getAll() + "\n";
          }
          foreach (Sandwich e in sandwichRep.getAll())
          {
              writeMe = writeMe + e.getAll() + "\n";
          }
          foreach (Cake e in cakeRep.getAll())
          {
              writeMe = writeMe + e.getAll() + "\n";
          }
  
          wr.Write(writeMe);
          wr.Close();
      }
  }
  </code></pre>
  
  <p>I've changed AppController to public, but I get again, more errors. The same error, but for breadRep, cakeRep, sandwichRep.</p>