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