public StudentClass(char level, int number, Teacher educator, int maxStudents)
{
this.level = level;
this.number = number;
this.educator = educator;
this.numStudents = 0;
this.students = new Student[maxStudents];
}
public StudentClass(char level, int number)
{
this.level = level;
this.number = number;
this.numStudent = 0;
this.students = new Student[STANDART];
}
它给我一个错误的单词 - StudentClass 请帮我 .... 谢谢你
答案 0 :(得分:7)
除了构造函数之外,C#中的所有方法都必须指定返回类型。如果您不想返回类型应为void
的值。
看起来这些方法都是构造函数的可能性很大,如果是这种情况,那么名称必须与类名完全匹配,否则编译器将不会识别它并且会给出错误。