Beispiel #1
0
        static void Main(string[] args)
        {
            var sq = new Square {
                Side = 4
            };
            var rc = new SquareToRectangleAdapter(sq);

            Console.WriteLine(ExtensionMethods.Area(rc));
        }
Beispiel #2
0
        static void DemoAdapter()
        {
            var square = new Adapter.Square()
            {
                Side = 12
            };
            var adpetedSquare = new SquareToRectangleAdapter(square);

            var area1 = Math.Pow(square.Side, 2);
            var area2 = adpetedSquare.Area();

            Console.WriteLine($"Square area is { area1 } and Rectangle area is { area2 }");
        }