Last active
April 8, 2020 23:03
-
-
Save mandel-macaque/c959a87b8df9d756aa6a5b21e022747a 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
class MyClass () | |
{ | |
} | |
class YourClass () | |
{ | |
} | |
static void Print(MyClass o) | |
{ | |
Console.WriteLine ("My class!"); | |
} | |
static void Print(YourClass o) | |
{ | |
Console.WriteLine ("Your class"); | |
{ | |
static void Main () | |
{ | |
MyClass o; | |
Print (o ?? new YouClass); | |
} |
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
class MyClass () | |
{ | |
} | |
class YourClass () | |
{ | |
} | |
static void Print(MyClass o) | |
{ | |
Console.WriteLine ("My class!"); | |
} | |
static void Print(YourClass o) | |
{ | |
Console.WriteLine ("Your class"); | |
{ | |
static void Main () | |
{ | |
MyClass o; | |
if (o == null) | |
Print(new YourClass()); | |
else | |
Print (o); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment