Home / C# Programming / Properties :: Discussion

Discussion :: Properties

  1. 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?

  2. A.

    Declare age property with only get accessor.

    B.

    Declare age propery with only set accessor.

    C.

    Declare age property with both get and set accessor.

    D.

    Declare age property with get, set and normal accessors.

    E.

    None of the above.

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    No answer description available for this question.


Be The First To Comment