C#基础问题希望得到您的帮助
class Student
{
#region 姓名
private string name;
/// <summary>
/// 姓名
/// </summary>
public string Name
{
get { return name; }
set { name = value; }
}
#endregion
#region 学号
private string xuehao;
/// <summary>
/// 学号
/// </summary>
public string Xuehao
{
get { return xuehao; }
set { xuehao = value; }
}
#endregion
#region 年龄
private int age;
/// <summary>
/// 年龄
/// </summary>
public int Age
{
get { return age; }
set { age = value; }
}
#endregion
#region 性别
private string sex;
/// <summary>
/// 性别
/// </summary>
public string Sex
{
get { return sex; }
set { sex = value; }
}
#endregion
public Student(string name, string xuehao, int age)
{
this.name = name;
this.xuehao = xuehao;
this.age = age;
}
public void SayHi()
{
Console.WriteLine("我叫" + this.name + "我的学号" + this.xuehao + "我的年龄" + this.age);
}
public void SayHi1()
{
Console.WriteLine("我叫" + this.name + "我的学号" + this.xuehao + "我的年龄" + this.age+"我是"+this.sex);
}
public Student(string name, string xuehao, int age, string sex)
: this(name, xuehao, age)
{
this.sex = sex;
}
}
这里是Main函数
Student s1 = new Student("张三", "110", 20);
Student s2 = new Student("李四", "111", 21,"男");
s2.SayHi1();
s1.SayHi();
Console.Read();
问题:第二个构造函数中:this(string name……)代表什么意思
------解决方案--------------------在第二个构造中调用另一个构造函数
------解决方案--------------------