48 lines
666 B
C#
48 lines
666 B
C#
|
using Builder.Products;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace Builder.Builder
|
|||
|
{
|
|||
|
internal class ConcreteBuilder : IBuilder
|
|||
|
{
|
|||
|
private Product _product = new Product();
|
|||
|
|
|||
|
public ConcreteBuilder()
|
|||
|
{
|
|||
|
Reset();
|
|||
|
}
|
|||
|
|
|||
|
public void Reset()
|
|||
|
{
|
|||
|
_product = new Product();
|
|||
|
}
|
|||
|
|
|||
|
public void BuildPartA()
|
|||
|
{
|
|||
|
_product.Add("PartA1");
|
|||
|
}
|
|||
|
|
|||
|
public void BuildPartB()
|
|||
|
{
|
|||
|
_product.Add("PartB1");
|
|||
|
}
|
|||
|
|
|||
|
public void BuildPartC()
|
|||
|
{
|
|||
|
_product.Add("PartC1");
|
|||
|
}
|
|||
|
|
|||
|
public Product GetProduct()
|
|||
|
{
|
|||
|
Product product = _product;
|
|||
|
Reset();
|
|||
|
|
|||
|
return product;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|