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?
Discussion:1 comments Page 1 of 1.
Ram said: 1 decade 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: