C# Programming - Properties - Discussion
Discussion Forum : Properties - General Questions (Q.No. 3)
A Student class has a property called rollNo and stu is a reference to a Student object and we want the statement stu.RollNo = 28 to fail. Which of the following options will ensure this functionality?
No answer description is available. Let's discuss.
Discussion:1 comments Page 1 of 1.
Ram said: 10 years ago
In property, get accessor implies read only and set accessor implies write only. So here we want to stop setting a value. Remove set accessor.
Post your comments here: