Skip to content

Instantly share code, notes, and snippets.

@dsibinski
Last active February 17, 2019 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsibinski/1a1af2c889fe5f101c59e65cf1107b3b to your computer and use it in GitHub Desktop.
Save dsibinski/1a1af2c889fe5f101c59e65cf1107b3b to your computer and use it in GitHub Desktop.
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