根据视频自学到结构这,做了下练习,出错,求指教
namespace _20121017
{
class Program
{
enum sex
{
男,女,
}
public struct Person
{
public string xm;
public sex xb;
public int nl;
}
static void Main(string[] args)
{
Person ZS;
ZS.xm = "张三";
ZS.xb=sex.男;
ZS.nl = 18;
Console.WriteLine("我叫{0},今年{1}岁了,我是{2}孩", ZS.xm, ZS.nl, ZS.xb);
Person XL;
XL.xm = "小兰";
XL.xb = sex.女;
XL.nl = 16;
Console.WriteLine("我叫{0},今年{1}岁了,我是{2}孩", XL.xm, XL.nl, XL.xb);
Console.ReadKey();
}
}
}
提示错误:可访问性不一致: 字段类型“_20121017.Program.sex”比字段“_20121017.Program.Person.xb”的可访问性低
啥意思? |