Skip to content

Instantly share code, notes, and snippets.

@idavis
Created February 15, 2012 18:46
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 idavis/1838090 to your computer and use it in GitHub Desktop.
Save idavis/1838090 to your computer and use it in GitHub Desktop.
True Late Binding
public class Foo {
public void Bar() {
if(IsBaz()) {
Console.WriteLine("CRAP");
} else {
Console.WriteLine("W00T");
}
}
public bool IsBaz() {
return true;
}
}
// Get this to work:
Foo foo = new Foo(); // You can replace the rhs of this line
foo.Bar(); // should output: W00T, but will output CRAP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment