Discussion Forum

  1. Home
  2. »
  3. Languages
  4. »
  5. An Employee class has a...
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?

Declare age property with only get accessor.

Declare age property with only set accessor.

Declare age property with both get and set accessors.

Declare age property with get, set and normal accessors.

Answer: B . Declare age property with only set accessor.
0Shares
0 0

If you think the posted answer is wrong or Confused About the Answer? Ask for Details Here

Know Explanation? Add it Here
we’ll review your comment and contact you soon….

Leave a Reply

Your email address will not be published. Required fields are marked *

0Shares
0
Scroll to Top