Ejemplo n.º 1
0
 public void Execute()
 {
     Console.WriteLine("请选择产品:1.Iphone 2.Ipad");
     string productNumber = Console.ReadLine();
     AppleFactory af=null;
     if (productNumber=="1")
     {
         af = new IphoneFactory();
     }
     else
     {
         af = new IpadFactory();
     }
     af.CreateProductSize().Size();
     af.CreateProductPrice().Price();
 }
Ejemplo n.º 2
0
        public void Execute()
        {
            Console.WriteLine("请选择产品:1.Iphone 2.Ipad");
            string       productNumber = Console.ReadLine();
            AppleFactory af            = null;

            if (productNumber == "1")
            {
                af = new IphoneFactory();
            }
            else
            {
                af = new IpadFactory();
            }
            af.CreateProductSize().Size();
            af.CreateProductPrice().Price();
        }