Skip to content

Instantly share code, notes, and snippets.

@jaredpar
Created June 9, 2014 00:46
Show Gist options
  • Save jaredpar/2700641cb5553641943b to your computer and use it in GitHub Desktop.
Save jaredpar/2700641cb5553641943b to your computer and use it in GitHub Desktop.
static void Main(string[] args)
{
A a = default(A);
D d = new D();
d.Foo(a); // Prints D.Foo
}
struct A { }
struct B
{
public static implicit operator B(A a)
{
return default(B);
}
}
class C
{
}
class D : C
{
public virtual void Foo(A a)
{
Console.WriteLine("C.Foo");
}
public virtual void Foo(B b)
{
Console.WriteLine("D.Foo");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment