class Person{ public int Width { set { this.Width = value; } get { return 0; } }}Person p = new Person();p.Width = 30;未處理的“System.StackOverflowException”類型的異常出現(xiàn)在 Property.exe 中。請問大家,當(dāng)p.Width=30;時為什么會報錯呢?聽別人說,屬性是不保存數(shù)據(jù)的,字段才保存數(shù)據(jù),是這樣嗎?
- 2 回答
- 0 關(guān)注
- 413 瀏覽
添加回答
舉報
0/150
提交
取消