abstract 类也可以继承 实体类

public class BaseReq
{
public String UserId { get; set;
}
public BaseReq()
{

}
}
public abstract class CommonReq:BaseReq
{

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:09  zslm___  阅读(647)  评论(0编辑  收藏  举报