Created
June 9, 2014 00:46
-
-
Save jaredpar/2700641cb5553641943b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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