General Questions

Question 11 :

An Employee class has a property called age and emp is reference to a Employee object and we want the statement Console.WriteLine(emp.age) to fail. Which of the following options will ensure this functionality?


A). Declare age property with only get accessor.
B). Declare age property with only set accessor.
C). Declare age property with both get and set accessors.
D). Declare age property with get, set and normal accessors.
E). None of the above
Answer : Option B