Compiler Error CS1018

应输入关键字“this”或“base”

编译器遇到了不完整的构造函数声明。

下面的示例生成 CS1018 并建议了几种解决此错误的方法:

// CS1018.cs
public class C
{
}

public class a : C
{
    public a(int i)
    {
    }

    public a () :   // CS1018
    // possible resolutions:
    // public a () resolves by removing the colon
    // public a () : base() calls C's default constructor
    // public a () : this(1) calls the assignment constructor of class a
    {
    }

    public static int Main()
    {
        return 1;
    }
}