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í)為什么會(huì)報(bào)錯(cuò)呢?聽別人說,屬性是不保存數(shù)據(jù)的,字段才保存數(shù)據(jù),是這樣嗎?
- 2 回答
- 0 關(guān)注
- 489 瀏覽
添加回答
舉報(bào)
0/150
提交
取消