What will be the output of the following C# code? [code] class maths { public int length; public int breadth; public

Ngoc Hue

New member
What will be the output of the following C# code?
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.
Code:
 8, 10
D. 7, 8
 

Tìm kiếm

Back
Top