Guest User

Untitled

a guest
Jun 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. public class ChimpEnum
  2. {
  3. public readonly static ChimpEnum ChimpInZoo = new ChimpEnum("chimpy", chimp => chimp.EatBanana());
  4. public readonly static ChimpEnum GeorgeBush = new ChimpEnum("dubya", chimp => { chimp.FlingPoo();
  5. chimp.StartWarInIraq(); });
  6.  
  7. private readonly string name;
  8. private readonly Action<Chimp> doSomething;
  9.  
  10. private ChimpEnum(string name, Action<Chimp> doSomething)
  11. {
  12. this.name = name;
  13. this.doSomething = doSomething;
  14. }
  15.  
  16. public void DoSomething(Chimp chimp)
  17. {
  18. doSomething(chimp);
  19. }
  20.  
  21. public static ChimpEnum getInstance(String name)
  22. {
  23. // Return correct instance here.
  24. return null;
  25. }
  26. }
  27.  
  28. public class Chimp
  29. {
  30. public void EatBanana()
  31. {
  32. }
  33.  
  34. public void FlingPoo()
  35. {
  36. }
  37.  
  38. public void StartWarInIraq()
  39. {
  40.  
  41. }
  42. }
Add Comment
Please, Sign In to add comment