-5
 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请帮助我....谢谢你

4

1 回答 1

7

除了构造函数之外,C# 中的所有方法都必须指定返回类型。如果您不想返回该类型应该是的值void

看起来这两个方法都是构造函数的可能性很大,如果是这种情况,那么名称必须与类名完全匹配,否则编译器将无法识别它并给出错误。

于 2013-06-10T21:48:18.483 回答