问个属性的问题,一直不明白。(只有十分了,不知道为什么)
public class mpe
{
private string _e1;
private string _e2;
public mpe()
{
}
public mpe(string e1,string e2)
{
this._e1 = e1;
this._e2 = e2;
}
public String e1
{
get
{
return "hello";
}
}
}
调用的时候:
return new mpe(e1, e2); 为什么这样调用就可以返回hello呢?
==================================我找到的第二种 写法。
public class mpe
{
private string _e1;
private string _e2;
public mpe()
{
}
public mpe(string e1,string e2)
{
this._e1 = e1;
this._e2 = e2;
}
public String e1_A
{
get
{
return "hello";
}
}
}
mpe mpe1= new mpe("**", "***");
string aa = mpe1.e1_A;
如果我用return new ("***","***")可不是不是也返回hello呀,为什么,我是个初学者