Last active
February 17, 2019 21:14
-
-
Save dsibinski/1a1af2c889fe5f101c59e65cf1107b3b 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
interface IDeveloper | |
{ | |
void LearnNewLanguage(string language, DateTime dueDate); | |
void LearnNewLanguage(string language) | |
{ | |
// default implementation | |
LearnNewLanguage(language, DateTime.Now.AddMonths(6)); | |
} | |
} | |
class BackendDev : IDeveloper // compiles OK | |
{ | |
public void LearnNewLanguage(string language, DateTime dueDate) | |
{ | |
// Learning new language... | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
IDeveloper dev = new BackendDev(); | |
dev.LearnNewLanguage("Rust"); // OK - default implementation of | |
// IDeveloper.LearnNewLanguage(string language) is called | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment