public static void sMain(string[] args) { ShapeFactory factory = new ShapeFactory(); CircleWorker cworker = new CircleWorker(); RectangleWorker rworker = new RectangleWorker(); Surface surface = new Surface(factory); factory.AddWorker(cworker); factory.AddWorker(rworker); for (int i = 0; i < 6; i++) { surface.AddNewShape(); } foreach (Shape shape in surface.Shapes) { shape.PrintInfo(); } Console.WriteLine(""); Console.WriteLine("Sumaryczne pole figur na płaszczyźnie to {0}", surface.ComputeTotalArea()); Console.WriteLine("Sumaryczny obwód figur na płaszczyźnie to {0}", surface.ComputeTotalPerimeter()); }
public Surface(ShapeFactory factory) { shapes = new List <Shape>(); this.factory = factory; }