class Program
{
public void x(int a, float b , float c)
{
Console.WriteLine("Method 1 ");
}
public void x(float a, int b,int c)
{
Console.WriteLine("Method 2 ");
}
static void Main(string[] args)
{
Program ob = new Program();
ob.x(1, 2, 3);
}
}
ob.x(1,2,3)
is showing
Error 1 The call is ambiguous between the following methods or properties: '
OverloadDemo.Program.x(int, float, float)
' and 'OverloadDemo.Program.x(float, int, int)
'C:\Users\Public\Videos\SampleVideos\Projectss\OverloadDemo\OverloadDemo\Program.cs 25 13 OverloadDemo
Method 2has two arguments of
inttype and
Method 1has two argumets of
int` type.
So Method 1 should be favoured.
Why is there an error ?