static void Main(string[] args) { int w = 4, h = 5; Rectangle rec = new Rectangle() { Width = w, Height = h }; AreaCalculator ac = new AreaCalculator(); Console.WriteLine("Prostokąt o wymiarach {0}x{1} ma pole {2}", w, h, ac.CalculateArea(rec)); Console.ReadLine(); }
static void Main(string[] args) { int w = 4, h = 5; Rectangle rect = new Rectangle() { Width = w, Height = h }; AreaCalculator calc = new AreaCalculator(); Console.WriteLine("prostokat o wymiarach {0} na {1} ma pole {2}", w, h, calc.CalculateArea(rect)); Square squa = new Square() { Side = w }; Console.WriteLine("kwadrat o wymiarach {0} na {1} ma pole {2}", w, w, calc.CalculateArea(squa)); }