SHARE
TWEET

Untitled

a guest Jul 22nd, 2011 91 Never
  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. }
RAW Paste Data
Top