Vidyalelo
C# Programming · Q161

Classes and Objects in C Sharp

Programming · C# Programming · question 161

Q161

What will be the output of the following C# code? class maths public int length; public int breadth; public maths(int x) length = x + 1; public maths(int x, int y) length = x + 2; class Program static void Main(string[] args) maths m = new maths(6); maths k = new maths(6, 2); Console.WriteLine(m.length); Console.WriteLine(k.length); Console.ReadLine();

A.
8, 8
B.
0, 2
C.
8, 10
D.
7, 8
Answer

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board