Is it overloaded ?What will be the output ?
using System;
using System.Collections.Generic;
using System.Linq;
namespace LinqDetails
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Add(2, 2));
Console.ReadLine();
}
public static double Add(int a, double b)
{
return a + b;
}
public static double Add(double a, int b)
{
return a + b;
}
}
}
Output:-
Yes it is overloaded. But the above program will give an compile time error.
Error:- The call is ambiguous between the following methods or properties: 'LinqDetails.Program.Add(int, double)' and 'LinqDetails.Program.Add(double, int)'
No comments:
Post a Comment