using System;
interface Display
{
void Print();
}
class B : Display
{
public void Print()
{
Console.WriteLine("Base Display. ");
}
}
class D : B
{
public new void Print()
{
Console.WriteLine("Derived Display. ");
}
}
class InterfaceTest
{
static void Main()
{
D d=new D();
d.Print();
Display dis = (Display)d;
dis.Print();
Console.ReadKey();
}
}
Output:-
No comments:
Post a Comment