I have a Class named Person (Internal Class Person) and wanted to intiate on a winform.
internal class Person
{
public string Name { get; set; }
public byte Age { get; set; }
public Person(string name, byte age)
{
Name = name;
Age = age;
}
}
Let's say i want to create it within a class named "NewClass" so i would do the following:
class NewClass
{
public Person John;
Clase2()
{
this.John.Age = 33;
}
}
However whenever i try to do it on a Win form:
public partial class Form2 : Form
{
public Person Sam;
public Form2()
{
InitializeComponent();
// Person test = new Person();
this.Sam.Age = 33;
}
}
I get the following message:
Error CS0052 Inconsistent accessibility: field type 'Person' is less accessible than field 'Form2.Sam' Prueba Clase Persona D:\Documents\Clases C#\Prueba\Prueba Clase Persona\Form2.cs 15 Active
Is that because System.Windows.Forms, is a reference outside my "app" ? Because whenever i make the class Person Public, instead of Internal, the debugger accepts it.