Advertisement
Guest User

Guest code

a guest
Jan 9th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. class Guest
  2. {
  3.     private Host host;
  4.  
  5.     public Guest(Host host)
  6.     {
  7.         this.host = host;
  8.     }
  9.  
  10.     private List<Fruit> GetFruit()
  11.     {
  12.         return host.FruitBowl;
  13.     }
  14.  
  15.     private void Print(string s)
  16.     {
  17.         host.Print(s);
  18.     }
  19.  
  20.     public void Run()
  21.     {
  22.         // custom code is inserted here
  23.         List<Fruit> fruitBowl = GetFruit();
  24.         foreach(Fruit fruit in fruitBowl)
  25.         {
  26.             Print("This fruit is " + fruit.Name);
  27.         }
  28.         // end of custom code
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement