public class Test
{
int i;
private char p1;
private char p2;
static Test()
{
}
public Test()
{
i = 1;
Console.WriteLine("I am Test 默认构造函数 i={0}", i);
}
public Test(string str)
{
//i = 1;
Console.WriteLine("I am Test 默认构造函数 i={0}", str);
}
public Test(string str, string dt)
{
Console.WriteLine("I am Test 默认构造函数 i={0}", str);
Console.WriteLine("I am Test 默认构造函数 i={0}", dt);
}
public Test(char p1, char p2)
{
// TODO: Complete member initialization
this.p1 = p1;
this.p2 = p2;
Console.WriteLine("I am Test 默认构造函数 i={0}", p1);
Console.WriteLine("I am Test 默认构造函数 i={0}", p2);
}
}
public class ProgramTest
{
static void Main(string[] args)
{
Test t = new Test(‘3‘, ‘2‘);
Console.Read();
}
来源: http://www.bubuko.com/infodetail-2275363.html