public Employee(string name,string alias){// Use this to qualify the fields,name and alias:this.name = name;this.alias = alias;}this的用法this.name=name 具体点我有点狠难理解
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/09 05:11:10
publicEmployee(stringname,stringalias){//Usethistoqualifythefields,nameandalias:this.name=name;this.
public Employee(string name,string alias){// Use this to qualify the fields,name and alias:this.name = name;this.alias = alias;}this的用法this.name=name 具体点我有点狠难理解
public Employee(string name,string alias)
{
// Use this to qualify the fields,name and alias:
this.name = name;
this.alias = alias;
}
this的用法this.name=name 具体点我有点狠难理解
public Employee(string name,string alias){// Use this to qualify the fields,name and alias:this.name = name;this.alias = alias;}this的用法this.name=name 具体点我有点狠难理解
这是个构造函数,this.name指当前类的属性,后一个name是构造函数中的参数
这就是给类中的属性赋值
这样写就清楚了
public Employee(string strName,string strAlias)
{
// Use this to qualify the fields,name and alias:
this.name = strName;
this.alias = strAlias;
}