Skip to content

Instantly share code, notes, and snippets.

@Zerophase
Created July 17, 2014 19:03
Show Gist options
  • Save Zerophase/a7256b3efda9382fd2aa to your computer and use it in GitHub Desktop.
Save Zerophase/a7256b3efda9382fd2aa to your computer and use it in GitHub Desktop.
Public class DoSomething : IDoSomething
{
public void DoSomethingCool()
{
//Do Something Cool
}
}
Public class DoSomethingElse : IDoSomething
{
public void DoSomethingCool()
{
// Do Something Else Cool
}
}
public interface IDoSomething
{
void DoSomethingCool();
}
Public class UseADoSomething
{
private IDoSomething doSomething;
public void Initialize(IDoSomething doSomething)
{
this.doSomething = doSomething
}
public void CallADoSomething()
{
doSomething.DoSomethingCool();
}
}
@Zerophase
Copy link
Author

If needed other classes can inherit UseADoSomething and override methods, if the logic for when something cool happens needs to be different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment