321.
class BC { public virtual void Display() { System.Console.WriteLine("BC::Display"); } } class DC : BC { public override void Display() { System.Console.WriteLine("DC::Display"); } } class Demo { public static void Main() { BC b; b = new BC(); b.Display(); b = new DC(); b.Display(); } } Output?
View Description
The function Display() of Base class BC is declared as virtual, while the Derived class's implementation of Display() is decorated with the modifier override.
Doing so enables C# to invoke functions like Display() based on objects the reference variable refers to and not the type of reference that is invoking the function.
Hence in the above program when b refers to the object of class BC it invokes Display() of BC and then when b refers to the object of class DC it invokes Display() of class DC.
Answer has been verified