On the lines of Geoff's
post (sorry Geoff for doing this without permissions), what will be the output of the following program ? (and why?)
using System;
class A
{
public virtual void Foo()
{
Console.WriteLine("Call on A.Foo()");
}
}
class B : A
{
public virtual void Foo()
{
Console.WriteLine("Call on B.Foo()");
}
}
class C : B
{
public override void Foo()
{
Console.WriteLine("Call on C.Foo()");
}
}
class D
{
static void Main()
{
A c1 = new C();
c1.Foo();
Console.ReadLine();
}
}