abstract 类 构造函数

public abstract class CommonReq
{

private String TransNo { get; set; }

public String SubmitData { get; set; }



private String Sign { get; set; }

public String Encoding { get; set; }

public CommonReq()
{
this.TransNo = Guid.NewGuid().ToString();
}
}
class Request:CommonReq
{

}
class Program
{
static void Main(string[] args)
{
Request req = new Request
{
SubmitData="A=1",
Encoding="utf-8"
};
var req2 = Activator.CreateInstance(typeof(Request)) as CommonReq;

}

}

仍然可行

posted @ 2016-04-28 10:06  zslm___  阅读(555)  评论(0编辑  收藏  举报