this 关键字
来源:互联网 发布:sql server 2008使用 编辑:程序博客网 时间:2024/05/28 15:43
this 关键字在类中,用于访问该类的成员。当类实例化后,this代表被实例化的对象。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ThisTest
{
class Person
{
private string name;
private int age;
private string hobby;
public Person(string name, int age, string hobby)
{
this.name = name; //在这里this 代表类的本身,故=得左边的this.name代表类的字段,=右边name代表局部变量
this.age = age;
this.hobby = hobby;
}
public void Display()
{
Console.WriteLine(this.name +", "+this.age +
"岁, 喜欢"+this.hobby);
}
}
}
- 关键字this
- this关键字
- this关键字
- this 关键字
- this 关键字
- this关键字
- this关键字
- this 关键字
- this 关键字
- this 关键字
- this关键字
- 关键字this
- 关键字this
- this 关键字
- this 关键字
- this关键字
- this关键字
- This关键字
- Amen〃 家族来临~
- XSL(EXtensible Stylesheet Language)它是指可扩展样式表语言
- Google Adsense西联汇款邮政储蓄收款流程
- (转) 解决" 0X000000该内存不能为read" 的方法
- ssh 连接很慢的解决办法
- this 关键字
- 推荐:Linux入门11点建议
- 关于解决Jmail发送附件和html邮件的问题
- 如何写求职简历
- 对Nand flash读操作的分析(转)
- javascript获得url中的参数
- 网上求职七部曲
- 寂寞的美丽
- 双击VC对话框提示cannot add new member的解决方法