What Will Be The Output Of The Following C Codep Pre Langcsharp #375
What will be the output of the following C# code?</p> <pre><code class="language-csharp" line="1"> class maths { public int x; public double y; public int add(int a, int b) { x = a + b; return x; } public int add(double c, double d) { y = c + d; return (int)y; } public maths() { this.x = 0; this.y = 0; } } class Program { static void Main(string[] args) { maths obj = new maths(); int a = 4; double b = 3.5; obj.add(a, a); obj.add(b, b); Console.WriteLine(obj.x + " " + obj.y); Console.ReadLine(); } } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs108 CSharp. It can also be found in gs gs108 Object Oriented Concepts - Method Overloading - Quiz No.1.