static void Main(string[] args) { try { Console.WriteLine("请输入你所要求的图形的英文名称:"); IChart chart = ChartFactory.GetChart(Console.ReadLine()); chart.display(); } catch { Console.WriteLine("请输入标准"); } }
static void Main(string[] args) { Chart chart1 = ChartFactory.getChart("Triangle"); chart1.display(); Chart chart2 = ChartFactory.getChart("Circular"); chart2.display(); Chart chart3 = ChartFactory.getChart("Square"); chart3.display(); Chart chart4 = ChartFactory.getChart("Rectangle"); chart4.display(); }
static void Main(string[] args) { Chart chart_1 = ChartFactory.GetChart("triangle"); chart_1.display(); Chart chart_2 = ChartFactory.GetChart("circle"); chart_2.display(); Chart chart_3 = ChartFactory.GetChart("square"); chart_3.display(); Chart chart_4 = ChartFactory.GetChart("rectangle"); chart_4.display(); }