Skip to content

Instantly share code, notes, and snippets.

@JayBazuzi
Created December 6, 2014 22:19
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 JayBazuzi/798bdca40d59e095e83b to your computer and use it in GitHub Desktop.
Save JayBazuzi/798bdca40d59e095e83b to your computer and use it in GitHub Desktop.
class Program
{
private static void Main(string[] args)
{
IOperation operation;
switch (args[0])
{
case "foo":
{
operation = new FooOperation();
break;
}
case "bar":
{
operation = new BarOperation();
break;
}
case "baz":
{
operation = new BazOperation();
break;
}
default:
throw new System.Exception();
}
operation.Do();
}
}
class BazOperation : IOperation
{
public void Do()
{
}
}
class FooOperation : IOperation
{
public void Do()
{
}
}
class BarOperation : IOperation
{
public void Do()
{
}
}
interface IOperation
{
void Do();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment