Last active
January 27, 2021 15:37
-
-
Save jsanjuan2016/f8105e4daaf31ab8aa0ae0ef2ad991ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WindowManager | |
{ | |
private readonly IShapeFactory<Rectangle> _rectangleFactory; | |
private readonly IShapeFactory<Cirlce> _CircleFactory; | |
public WindowManager(IShapeFactory<Rectangle> rectangleFactory, IShapeFactory<Cirlce> CirlceFactory) | |
{ | |
this._rectangleFactory = rectangleFactory ?? throw new ArgumentNullException(nameof(rectangleFactory)); | |
this._CircleFactory = CirlceFactory ?? throw new ArgumentNullException(nameof(CirlceFactory)); | |
} | |
public void CreateRectangleWithUserParams(IShapeParameters parameters) | |
{ | |
IShape rectangle = this._rectangleFactory.CreateShape(parameters); | |
Console.WriteLine($"Factory: Rectangle created"); | |
Console.WriteLine($"Factory: El área del Rectangle es: {rectangle.getArea():0.00}"); | |
} | |
public void CreateCircleWithUserParams(IShapeParameters parameters) | |
{ | |
IShape Cirlce = this._CircleFactory.CreateShape(parameters); | |
Console.WriteLine($"Factory: Cirlce created"); | |
Console.WriteLine($"Factory: El área de la ventana es: {Cirlce.getArea():0.00}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment