Home » C# Programming » Properties

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?

Correct Answer: Declare age property with only set accessor.

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion