コード例 #1
0
 public void BeginBuild(ComplexProduct existingComplexProduct = null)
 {
     if (existingComplexProduct == null)
     {
         _complexProduct = new ComplexProduct();
     }
     else
     {
         _complexProduct = existingComplexProduct;
     }
 }
コード例 #2
0
        public void TestCase1()
        {
            AbstractComplexProductBuilder  builder  = new ConcreteProductBuilderA("Sunday", 9);
            GoodWeatherAndGoodLuckDirector director = new GoodWeatherAndGoodLuckDirector();

            builder.BeginBuild();
            director.ConstructWithGoodWeatherAndGoodLuck(builder);
            ComplexProduct productWithGoodLuck = builder.EndBuild();

            builder.BeginBuild();
            director.ConstructWithBadWeatherAndBadLuck(builder);
            ComplexProduct productWithBadLuck = builder.EndBuild();
        }