- Online Exam Test Papers | - MCQs[multiple choice questions and answers ] | - Mock Test Papers | - Practice Papers | - Sample Test Papers |

Question:
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?

1.Declare age property with only get accessor.

2.Declare age property with only set accessor

3. Declare age property with both get and set accessors.

4.Declare age property with get, set and normal accessors.

Posted Date:-2021-02-25 10:06:08


More MCQS Questions and answers

Search