本帖最后由 WENZISUN 于 2013-12-10 10:15 编辑
enum Gender
{男,女}
public struct Person
{
public string name;
public int old;
public Gender sex;
}
class Program
{
static void Main(string[] args)
{
Person member1;
Person member2;
member1.name = "张三";
member1.old = 18;
member1.sex = Gender.男;
member2.name = "小兰";
member2.old = 16;
member2.sex = Gender.女;
Console.ReadKey();
错误 1 可访问性不一致: 字段类型“结构.Gender”比字段“结构.Person.sex”的可访问性低 D:\Documents\Visual Studio 2010\Projects\自学练习中\结构\Program.cs 23 23 结构
|