1.

Which of the following is the correct way to define the constructor(s) of the Sample class if we are to create objects as per the C#.NET code snippet given below? Sample s1 = new Sample(); Sample s2 = new Sample(9, 5.6f);

A. public Sample() { i = 0; j = 0.0f; } public Sample (int ii, Single jj) { i = ii; j = jj; }
B. public Sample (Optional int ii = 0, Optional Single jj = 0.0f) { i = ii; j = jj; }
C. public Sample (int ii, Single jj) { i = ii; j = jj; }
D. Sample s;
Answer» B. public Sample (Optional int ii = 0, Optional Single jj = 0.0f) { i = ii; j = jj; }


Discussion

No Comment Found