예제 #1
0
 public void Visit(UseRectangle rectangle)
 {
     rectangle.CalculatedArea();
     Console.WriteLine($"长方形长是:{rectangle._long}");
     Console.WriteLine($"长方形宽是:{rectangle._wide}");
     Console.WriteLine($"长方形周长是:{2*(rectangle._long+rectangle._wide)}");
 }
예제 #2
0
        public UseGraphical()
        {
            UseElement element  = new UseRectangle(10, 5);
            UseElement element1 = new UseCircular(5);

            elements.Add(element);
            elements.Add(element1);
        }