Which accessory create a read only property ? Ans is set explain ? why not get accessor | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Which accessory create a read only property ? Ans is set explain ? why not get accessor

11th Mar 2022, 3:25 PM
PRATIK
PRATIK - avatar
2 Answers
+ 3
If you omit the set method in a property. You cannot assign a value to the property. There fore it is read-only. So the set method itself does not make the property read-only, but omitting the set metjod does. if you have access to visual studio. Start a new project. Make a class. Make a property in this class. Do omit the set method of the property. Try to assign a value to this property. Visual studio will give an error, saying it is read-only.
11th Mar 2022, 6:18 PM
sneeze
sneeze - avatar
- 1
i am confuse get and set method
14th Mar 2022, 3:25 AM
PRATIK
PRATIK - avatar