using System;
namespace test7
{
class Class1
{
struct Student
{
public string ID;
public string Name;
public string Sex;
};
public Student InitStudent(string sID,string sName,string sSex)
{
this.ID=sID;
this.Name=sName;
this.Sex=sSex;
}
public Student ShowStudent(Student stu)
{
Console.WriteLine("学号是:{0}\n",stu.ID);
Console.WriteLine("姓名是:{0}\n",stu.Name);
Console.WriteLine("性别是:{0}\n",stu.Sex);
Console.ReadLine();
}
[STAThread]
static void Main(string[] args)
{
string id,name,sex;
Console.Write("学号:");
id=Console.ReadLine();
Console.Write("姓名:");
name=Console.ReadLine();
Console.Write("性别:");
sex=Console.ReadLine();
Class1 t=new Class1();
Student student=t.InitStudent(id,name,sex);
t.ShowStudent(student);
}
}
}
编译时提示红色标记的地方出错,出错提示为:可访问性不一致,返回类型test7.Class1.Student比方法test7.Class1.InitStudent的可访问性低。不知道是为什么,请高手赐教,不胜感谢!!!!