/*
* Created by SharpDevelop.
* User: noo
* Date: 2009-8-16
* Time: 16:22
*
* 定义类成员(属性),所有的成员都有自己的访问级别,public,private(默认),internal(项目内部),protected(类、派生类)
* 公共关键字static(静态成员)
*/
using System ;
class propertiesA
{
private string name;
public string Name
{
get { return this .name;} // 读
set // 写
{
this .name = value;
}
}
public void output()
{
Console.WriteLine ( " 这个人的姓名是: " + name);
}
}
class Test
{
static void Main()
{
propertiesA a = new propertiesA ();
a.Name = " 吴宝佑 " ; // 写入属性
a.output ();
}
}
* Created by SharpDevelop.
* User: noo
* Date: 2009-8-16
* Time: 16:22
*
* 定义类成员(属性),所有的成员都有自己的访问级别,public,private(默认),internal(项目内部),protected(类、派生类)
* 公共关键字static(静态成员)
*/
using System ;
class propertiesA
{
private string name;
public string Name
{
get { return this .name;} // 读
set // 写
{
this .name = value;
}
}
public void output()
{
Console.WriteLine ( " 这个人的姓名是: " + name);
}
}
class Test
{
static void Main()
{
propertiesA a = new propertiesA ();
a.Name = " 吴宝佑 " ; // 写入属性
a.output ();
}
}