What does this code print?
What does this code print, and why?
using System;
public class A
{
public void F(int i)
{
Console.WriteLine("A: {0}", i);
}
}
public class B: A
{
public void F(object o)
{
Console.WriteLine("B: {0}", o);
}
}
public class Test
{
public static void Main()
{
B b = new B();
b.F(1);
}
}
what about this code?
using System;
public class A
{
public void F(short i)
{
Console.WriteLine("A: {0}", i);
}
}
public class B: A
{
public void F(int i)
{
Console.WriteLine("B: {0}", i);
}
}
public class Test
{
public static void Main()
{
short val = 15;
B b = new B();
b.F(val);
}
}