DesignPattern/04.BuilderPattern/2.Code/main.cpp

26 lines
484 B
C++
Raw Normal View History

2019-10-19 07:52:26 +00:00
#include "BuilderPattern.h"
int main()
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
AbstractBuilder *builder;
//ָ<><D6B8><EFBFBD><EFBFBD>
Director *director = new Director();
//<2F><>Ʒ<EFBFBD><C6B7>House
House *house;
//ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5BDA8><EFBFBD><EFBFBD>A
builder = new ConcreteBuilderA();
director->setBuilder(builder);
house = director->construct();
house->printfHouseInfo();
//ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5BDA8><EFBFBD><EFBFBD>B
builder = new ConcreteBuilderB();
director->setBuilder(builder);
house = director->construct();
house->printfHouseInfo();
system("pause");
return 0;
}