日期:2014-05-19  浏览次数:20881 次

一个和java当中同样的功能,请问在c#当中如何实例,等待中.............
using   System;
class   A
{

A()
{
this(1,1);//我知道在java当中可以这样调用别的构造函数,不知道c#中怎么实现同样的功能?
Console.WriteLine( "张三 ");
}
A(int   a,int   b)
{
Console.WriteLine( "李四 ");
}
public   static   void   Main(string[]args)
{

}
}


------解决方案--------------------
A() : this(1,1)
------解决方案--------------------
public DataBaseOperate()
: this( "server=.;uie=sa;pwd=sa;database=StudentDB ")
{
}

public DataBaseOperate(string connectionString)
{
if (connectionString != " ")
{
m_ConnectionString = connectionString;
m_Connected = false;
}
m_sqlTransaction = false;
}

再帮你给个完整的示例