XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

Inconsistent accessibility: error question

Last post 7/20/2007 7:08 PM by JakeYankovic. 2 replies.
  • 7/20/2007 5:40 PM

    Inconsistent accessibility: error question

    I've been working on a Brick Break game and i wanted to add a level creator to it. I made it in another Windows game and I added a form to it so the user could select a level from 1 - 50 in a "numericUpDown" box. The problem that I have is that the bricks themselves are in an array of 150 brick class elements so I made a corresponding array of 150 brick elements in the form at first i just added a public method that you would sent the bricks array to from the main game like this

    #CODE
    namespace BrickBreakLevelCreator
    {
        public partial class LevelSave : Form
        {
            Brick[] bricks = Brick[150];
            public LevelSave()
            {
                InitializeComponent();
            }
            public void sendBricks(Brick[] brick)
            {//receive the bricks
                bricks = brick;
            }
            private void cmd_ok_Click(object sender, EventArgs e)
            {
                //code to save level
            }
        }
    }

    but this gives me a

    "Inconsistent accessibility: parameter type 'BrickBreakLevelCreator.Brick[]' is less accessible than method 'BrickBreakLevelCreator.LevelSave.sendBricks(BrickBreakLevelCreator.Brick[])'"

    Error i checked the help and got this code

    #CODE
    public class A
    {
        // Try making B public since F is public
        // B is implicitly private here
        class B
        {
        }

        public static void F(B b)  // CS0051
        {
        }

        public static void Main()
        {
        }
    }

    ok so i just made the brick array public and sent it after I called the form.Show() and i got this error

    "Inconsistent accessibility: field type 'BrickBreakLevelCreator.Brick[]' is less accessible than field 'BrickBreakLevelCreator.LevelSave.bricks"

    I checked the help and got this code

    #CODE
    class MyClass
    // try the following line instead
    // public class MyClass
    {
    }

    public class MyClass2  
    {
       public MyClass mf;   // CS0052
    }

    public class MyClass3
    {
       public static void Main()
       {
       }
    }


    but it dosn't seem like this has any thing to do with what I'm trying to do here is a link to the game so if anyone could help it would be appreciate.
  • 7/20/2007 5:57 PM In reply to

    Re: Inconsistent accessibility: error question

    Answer
    Reply Quote
    Check your Brick class definition, it should be public as well.
  • 7/20/2007 7:08 PM In reply to

    Re: Inconsistent accessibility: error question

    Thanks
Page 1 of 1 (3 items) Previous Next