这是一个拥有多个构造函数的类的模型 ,设计类的时候,如果有类似业务可以借鉴
//继承自用户类的VIP用户类
class VIPCustomer:Customer
{
//用于记录VIP用户的朋友名称
private string FirendName;
//VIP等级记
private uint VIPLevel;
//两个参数的构造函数,通过base访问基类的构造函数
public VIPCustomer(string name, string firendName)
: base(name)
{
//VIP用户的名称定义
this.FirendName = firendName;
}
//一个参数的构造函数,通过this访问自己的类的带有两个参数的构造函数
public VIPCustomer(string name)
: this(name, "<No Name>")
{
//由于访问了两个参数的构造函数,所以不需要任何代码
}
}