Created
July 17, 2014 19:03
-
-
Save Zerophase/a7256b3efda9382fd2aa 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
Public class DoSomething : IDoSomething | |
{ | |
public void DoSomethingCool() | |
{ | |
//Do Something Cool | |
} | |
} |
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
Public class DoSomethingElse : IDoSomething | |
{ | |
public void DoSomethingCool() | |
{ | |
// Do Something Else Cool | |
} | |
} |
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
public interface IDoSomething | |
{ | |
void DoSomethingCool(); | |
} |
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
Public class UseADoSomething | |
{ | |
private IDoSomething doSomething; | |
public void Initialize(IDoSomething doSomething) | |
{ | |
this.doSomething = doSomething | |
} | |
public void CallADoSomething() | |
{ | |
doSomething.DoSomethingCool(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If needed other classes can inherit UseADoSomething and override methods, if the logic for when something cool happens needs to be different.