slawea

Untitled

Oct 4th, 2017
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. interface IDependency
  2. {
  3.     void InjectDependencyFloor(IFloor floor);
  4.  
  5.     void InjectDependencyRoof(IRoof roof);
  6.  
  7.     void InjectDependencyWall(IWall wall);
  8. }
  9.  
  10. class Shop: IDependency
  11. {
  12.  
  13.     public IRoof roof;
  14.  
  15.     public IFloor floor;
  16.  
  17.     public IWall wall;
  18.  
  19.     public void InjectDependencyFloor(IFloor floor)
  20.     {
  21.         this.floor = floor;
  22.     }
  23.  
  24.     public void InjectDependencyRoof(IRoof roof)
  25.     {
  26.         this.roof = roof;
  27.     }
  28.  
  29.     public void InjectDependencyWall(IWall wall)
  30.     {
  31.         this.wall = wall;
  32.     }
  33.     //pozostałe metody
  34. }
  35.  
  36. static void Main(string[] args)
  37. {
  38.  
  39.     Shop shop = new Shop();
  40.     shop.InjectDependencyFloor(new Floor());
  41.     shop.InjectDependencyRoof(new Roof());
  42.     shop.InjectDependencyWall(new Wall());
  43.  
  44.     Console.ReadKey();
  45. }
Add Comment
Please, Sign In to add comment