Skip to content

Instantly share code, notes, and snippets.

Created September 1, 2012 16:19
Show Gist options
  • Save anonymous/3579198 to your computer and use it in GitHub Desktop.
Save anonymous/3579198 to your computer and use it in GitHub Desktop.
using System;
namespace ConsoleApplication1
{
interface ITest
{
void Method();
}
class Parent : ITest
{
void ITest.Method()
{
Console.WriteLine("Parent");
}
}
class Child : Parent, ITest
{
void ITest.Method()
{
Console.WriteLine("Child");
}
}
class Program
{
static void Main(string[] args)
{
var c = new Child();
Parent p = c;
object o = p;
((ITest)c).Method(); // Child
((ITest)p).Method(); // Child
((ITest)o).Method(); // Child
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment