C#错误:'TestApp'不包含带0参数的构造函数... NO BASE CLASS

时间:2014-01-25 08:33:59

标签: c#

我正在编码这些简单的线条。编译器给出了错误:

  

“'TestApp.test'不包含取0的构造函数   参数“

在If语句的行上。

using System;

public class test
{
    public int x;        
    void Evaltest()
    {
        if (this.x >3)
        {
            Console.WriteLine("The test is successful.");
        }
        else
        {
            Console.WriteLine("The test has failed.");
        }
    }
}


class Program
{
    static void Main()
    {
        test C1 = new test();
        C1.x = 4;                
        test C2 = new test();

        Console.WriteLine("x in C1 is {0}", C1.x);
        Console.WriteLine("x in C2 is {0}", C2.x);



    }
}

为什么会这样?我这里没有基类。这不是继承问题吗?

0 个答案:

没有答案