作者Epimenides (No.13)
看板C_Sharp
标题[问题] properties
时间Thu Apr 5 00:14:09 2007
class Data
{
private string name;
public string Name {
get { return name; }
set { name = value; }
}
public Data(string s){
// 请问各位这里会写
name = s;
// 还是
Name = s;
}
}
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.229.63.110
1F:推 tomex:call function也是要浪费时间,因此里头要写this.name=s 04/05 02:31
2F:推 tomex:注意,OO物必有属的概念,加上this.是很重要的写作习惯 04/05 02:32