Home / C# Programming / Properties :: Discussion

Discussion :: Properties

  1. If Sample class has a Length property with get and set accessors then which of the following statements will work correctly?

    1.  Sample.Length = 20;
    2.  Sample m = new Sample();
       m.Length = 10;
    3. Console.WriteLine(Sample.Length);
    4.  Sample m = new Sample(); 
       int len; 
       len = m.Length;
    5.  Sample m = new Sample();
       m.Length = m.Length + 20;

  2. A.

    1, 3

    B.

    2, 4, 5

    C.

    4 only

    D.

    3, 5

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    No answer description available for this question.


Be The First To Comment