Home » C# Programming » Constructors

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);

Correct Answer: public Sample() { i = 0; j = 0.0f; } public Sample (int ii, Single jj) { i = ii; j = jj; }

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion