此处属性,主要就是为了访问类的私有变量,既保证安全性,又能让别的类可以访问到。例如
class Card
{
private string name;
public string Name
{
get
{
return this.name;
}
set
{
this.name=value;
}
}
不过一般只用Get方法,不用Set方法
此处属性,主要就是为了访问类的私有变量,既保证安全性,又能让别的类可以访问到。例如
class Card
{
private string name;
public string Name
{
get
{
return this.name;
}
set
{
this.name=value;
}
}
不过一般只用Get方法,不用Set方法