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是构造函数中的参数
这就是给类中的属性赋值

this 关键字用于引用当前对象,不能对它进行赋值,但可以将this关键字的值赋值给另外一个变量。
posted @ 2015-04-30 18:23  小军的代码库  阅读(1902)  评论(0编辑  收藏  举报