简体   繁体   中英

Inconsistent accessibility: parameter type 'x' is less accessible than method 'y'

public partial class buyer : Form
{

   Client AbClient;
    public buyer(Client cli)
    {
        InitializeComponent();

        AbClient = cli;
    }

The function in which is throwing up the error.

public class Client {
}

Client is the class where the problem seems to be.

private void CheckAuth()
    {
        while (true)
        {
            if (!sAuth.IsAlive)
            {
                if(abClient.isAuthSucessful)
                    Application.Run(new buyer(abClient));
                break;  
            } 
        }
    }

This is where the Autobuyer form is called from. (Inside the first form which is started by the main())

I still don't know how to fix this, I've of course searched but no one seems to have the answer that works in my situation.

I think your AbClient needs to be declared as public, as at the moment it's private by default. See MSDN - "The return type and parameter types of a method must be at least as accessible as the method itself."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM