Reputation: 1
I've been fighting over this error because I've alredy read lots of questions in this blog but unfortunately, none of them have helped me.
The answers of those question say that the class in which the error is being held, should be public, and that seems to solve the problem. But all my classes are public, so I don't know which the problem or error is.
Error: Inconsistent accessibility: parameter type 'Parqueo.ClaseEmpleado' is less accessible than method 'Parqueo.FormMenuAdmin.FormMenuAdmin(Parqueo.ClaseEmpleado)'
Here is a my code:
namespace Parqueo
{
public partial class FormMenuAdmin : Form
{
public ClaseEmpleado Empleado = new ClaseEmpleado();
public FormMenuAdmin(ClaseEmpleado _Empleado) //'FormMenuAdmin' is marked as the red errod
{
Empleado = _Empleado;
InitializeComponent();
}
private void FormMenuAdmin_Load(object sender, EventArgs e)
{
//label1.Text = "Bienvenido" + Empleado._Nombre;
}
}
}
Upvotes: 0
Views: 169
Reputation: 59303
public FormMenuAdmin(...)
is a public constructor, i.e. something that could be used by anyone.
However, the parameter passed to the constructor
ClaseEmpleado _Empleado
is of a type that is not public and therefore is not available to anyone.
Conclusion: make ClaseEmpleado
public for everyone so that it can be passed to the constructor, otherwise it's impossible to use the constructor.
Upvotes: 0
Reputation: 13767
Where's the code for the class ClaseEmpleado? That class should be public.
Upvotes: 1