示例#1
0
        /// <summary>
        /// 加入简单工厂模式
        /// </summary>
        /// <param name="i"></param>
        public ProduceContext(int i)
        {
            switch (i)
            {
            case 1:
                produceStrategy = new ProduceStrategySummer();
                break;

            case 2:
                produceStrategy = new ProduceStrategyWinter();
                break;

            default:
                Console.WriteLine("没有此种策略");
                break;
            }
        }
示例#2
0
 public ProduceContext(ProduceStrategy ps)
 {
     this.produceStrategy = ps;
 }