[求助]给类声明属性的方式
class Test{
private int i;
public int I
{
get{return this.i;}
set{this.i=value;}
}
}
与
class Test
{
public int i;
}
都是声明属性 也都能对i操作 搞不懂有什么区别呢,哪位高人指点一下,谢了
那这样又有什么区别呢:
Test t1=new Test();
t1.I=10;
与
Test t1=new Test();
t1.i=10;
不都是给i赋值了吗 搞不懂 请指点了