this的两个作用:
1、代表当前类的对象;
2、在类当中显示的调用本类的构造函数 例如以下两个构造函数中:
public Students(string name,char gender,int age,int chinese,int math,int english)
{
this.Name = name;
this.Gender = gender;
this.Age = age;
this.Chinese = chinese;
this.Math = math;
this.English = english;
}
//为避免构造函数代码的冗余,我们可以使用this关键字
public Students(string name,char gender,int age):this(name,gender,age,0,0,0) //没有的参数用任意数值代替,但是必须要同类型数据
{
//this.Name = name;
//this.Gender = gender;
//this.Age = age;
}