This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 22nd, 2011  |  syntax: C#  |  size: 0.60 KB  |  views: 75  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class RedOrGreenFrobber
  2. {
  3.     private Frobber frobber;
  4.     private RedOrGreenFrobber(Frobber value) {
  5.          this.frobber = value;
  6.     }
  7.     public Value {
  8.          get { return frobber; }
  9.     }
  10.     public static RedOrGreenFrobber RedOrGreen(bool green) { ... } // return a green or red frobber
  11. }
  12. interface Frobber {
  13.     void Frob(Frotz frotz);
  14. }
  15. class RedFrobber implements Frobber { ... }
  16. class GreenFrobber implements Frobber { ... }
  17. public sealed class Frotz
  18. {
  19.     public void Frobbit(RedOrGreenFrobber frobber)
  20.     {
  21.          ...
  22.          frobber.Value.Frob(this);
  23.          ...
  24.     }
  25. }
clone this paste RAW Paste Data