Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface IDependency
- {
- void InjectDependencyFloor(IFloor floor);
- void InjectDependencyRoof(IRoof roof);
- void InjectDependencyWall(IWall wall);
- }
- class Shop: IDependency
- {
- public IRoof roof;
- public IFloor floor;
- public IWall wall;
- public void InjectDependencyFloor(IFloor floor)
- {
- this.floor = floor;
- }
- public void InjectDependencyRoof(IRoof roof)
- {
- this.roof = roof;
- }
- public void InjectDependencyWall(IWall wall)
- {
- this.wall = wall;
- }
- //pozostałe metody
- }
- static void Main(string[] args)
- {
- Shop shop = new Shop();
- shop.InjectDependencyFloor(new Floor());
- shop.InjectDependencyRoof(new Roof());
- shop.InjectDependencyWall(new Wall());
- Console.ReadKey();
- }
Add Comment
Please, Sign In to add comment