public interface Class1//ouput
{
void Display(string str);
}
public interface Class2 : Class1
{
void DisplayInt(int i);
}
public class Class3 : Class2
{
// Must be implemented, even though
// its base class interface doesn't declare this method
public void Display(string str)
{
Console.WriteLine(str);
}
public void DisplayInt(int i)
{
Console.WriteLine(i.ToString());
}
}
public class MyClass
{
public static void Main()
{
Class1 c = new Class3();
//c.DisplayInt(2); // Will work only when Class3 c = new Class3();
c.Display("for tango");
}
}
for tango
No comments:
Post a Comment