作业帮 > 数学 > 作业

public Employee(string name,string alias)

来源:学生作业帮 编辑:作业帮 分类:数学作业 时间:2024/07/03 08:56:48
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;
}