建造者模式

using System;

namespace 设计模式_建造者模式
{
class Program
{

    public abstract class House
    {

    }
    public abstract class Door
    {

    }
    public abstract class Wall
    {

    }
    public abstract class Windins
    {

    }
    public abstract class Floor
    {

    }
    public abstract class HouseCeiling
    {

    }

    public abstract class Builder
    {
        public abstract void BuilderDoor();
        public abstract void BuilderWall();
        public abstract void BuilderWindows();
        public abstract void BuilderFloor();
        public abstract void BuilderHouseCeiling();

        public abstract House GetHouse();
    }

    //客户程序
    static void Main(string[] args)
    {
        House house = GameManager.CreateHouse(new RomaHouseBuilder());
    }

    public class RomanHouse:House
    {

    }

    public class RomaHouseBuilder : Builder
    {
        public override void BuilderDoor()
        {
            throw new NotImplementedException();
        }

        public override void BuilderFloor()
        {
            throw new NotImplementedException();
        }

        public override void BuilderHouseCeiling()
        {
            throw new NotImplementedException();
        }

        public override void BuilderWall()
        {
            throw new NotImplementedException();
        }

        public override void BuilderWindows()
        {
            throw new NotImplementedException();
        }

        public override House GetHouse()
        {
            throw new NotImplementedException();
        }
    }

}

}

using System;
using System.Collections.Generic;
using System.Text;
using static 设计模式_建造者模式.Program;

namespace 设计模式_建造者模式
{
class GameManager
{
public static House CreateHouse(Builder builder)
{
builder.BuilderDoor();
builder.BuilderDoor();

        builder.BuilderWall();
        builder.BuilderWall();

        builder.BuilderWindows();
        builder.BuilderWindows();

        builder.BuilderFloor();
        builder.BuilderHouseCeiling();

        return builder.GetHouse();
    }
}

}