Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inconsistent Accessibility: Parameter type is less accessible than method

Tags:

c#

object

I'm trying to pass an object (a reference to the currently logged on user, basically) between two forms. At the moment, I have something along these lines in the login form:

private ACTInterface oActInterface;

public void button1_Click(object sender, EventArgs e)
    {
        oActInterface = new ACTInterface(@"\\actserver\Database\Premier.pad",this.textUser.Text,this.textPass.Text);

        if (oActInterface.checkLoggedIn())
        {
            //user has authed against ACT, so we can carry on
            clients oClientForm = new clients(oActInterface);
            this.Hide();
            oClientForm.Show();
        }
        else...

on the next form (clients), I have:

public partial class clients : Form
{
    private ACTInterface oActInt {get; set;}

    public clients(ACTInterface _oActInt)

...which results in me getting:

Error   1   Inconsistent accessibility: 
parameter type 'support.ACTInterface' is less accessible than method    
'support.clients.clients(support.ACTInterface)'  
c:\work\net\backup\support\support\clients.cs   20  16  support

I don't really understand what the problem is - both fields are private, and accessed by the relevant public method from the form. Googling doesn't really help, as it just points towards one element being public and the other private, which isn't the case here.

Anybody help?

like image 293
dodgrile Avatar asked Oct 05 '22 17:10

dodgrile


1 Answers

Constructor of public class clients is public but it has a parameter of type ACTInterface that is private (it is nested in a class?). You can't do that. You need to make ACTInterface at least as accessible as clients.

like image 427
jason Avatar answered Oct 08 '22 05:10

jason