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

19,271

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."

Share:
19,271
Aidan
Author by

Aidan

Updated on June 19, 2022

Comments

  • Aidan
    Aidan almost 2 years
    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.