主题:请教一个set和get问题
类中一个数据元素比如:
public class myclass
{
private object someting;
public object someting
{
set{ someting = value;}
get{return someting;}
}
}
那和直接把someting 设定为 public object someting而不用set,get有区别吗?
public class myclass
{
private object someting;
public object someting
{
set{ someting = value;}
get{return someting;}
}
}
那和直接把someting 设定为 public object someting而不用set,get有区别吗?