Code:
class Program
{
class A
{
public void abc(int x)
{
Console.WriteLine("abc from A");
}
}
class B : A
{
public void abc(double x)
{
Console.WriteLine("abc from B");
}
}
static void Main(string[] args)
{
B b = new B();
b.abc(100);
Console.ReadLine();
}
}
On calling abc() method from class B instance, eventhough we are passing integer data ie 100 as an argument still why the execution of the program goes with method parameter that is defined with double? Please note that there is a method already defined for integer in the parent class.
Why the output of the above program is "abc from B" rather than "abc from A". Kindly advise.