111,126
社区成员
发帖
与我相关
我的任务
分享using System;
class 方法A
{
// 公有构造函数,不需改动:
public 方法A()
{
}
public 方法A(string str)
{
私有方法A(str);
}
public 方法A(object obj)
{
私有方法A(obj);
}
public 方法A(string str, object obj)
{
私有方法A(str);
私有方法A(obj);
}
// 以下是私有方法A,如果需要改动,只要改动以下2个私有方法:
private void 私有方法A(string str)
{
string myStr = str;
}
private void 私有方法A(object obj)
{
object myObj = obj;
}
}using System;
class Test
{
public void 方法A()
{}
public void 方法A(string str)
{
string myStr = str;
}
public void 方法A(object obj)
{
object myObj = obj;
}
public void 方法A(string str, object obj)
{
方法A(str);
方法A(obj);
}
}
public 方法A()
{}
public 方法A(string str)
{
string myStr=str;
}
public 方法A(object obj)
{
object myObj=obj;
}
//我现在是这样做的,只是觉得还不是很爽。
public 方法A(string str, object obj):this(obj)
{
string myStr = str;
}
}
public class 方法A
{
public 方法A():this("")
{
}
public 方法A(string str):this(str,null)
{
}
public 方法A(object obj):this("",obj)
{
}
public 方法A(string str, object obj)
{
string myStr = str;
object myObj = obj;
}
}