► 概述 : 把构造函数链接起来,从而获得最少的代码重复,编写一个全包含构造函数
目的:类中的两个或者多个构造函数存在重复代码时,减少忘记更新其他构造函数而导致的错误。
示例:
public class A
{
private string a,b,c,d,e,f,g; public A(string a1,string b1,string c1,string d1,string e1,string f1,string g1) { this.a = a1; this.b = b1; this.c = c1; this.d = d1; this.e = e1; this.f = f1; this.g = g1; } public A(string a):this(a,"","","","","","") { }}