本文整理汇总了C++中Director::setBuilder方法的典型用法代码示例。如果您正苦于以下问题:C++ Director::setBuilder方法的具体用法?C++ Director::setBuilder怎么用?C++ Director::setBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Director
的用法示例。
在下文中一共展示了Director::setBuilder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
Car* car; // Final product
/* A director who controls the process */
Director director;
/* Concrete builders */
JeepBuilder jeepBuilder;
NissanBuilder nissanBuilder;
/* Build a Jeep */
std::cout << "Jeep" << std::endl;
director.setBuilder(&jeepBuilder); // using JeepBuilder instance
car = director.getCar();
car->specifications();
std::cout << std::endl;
/* Build a Nissan */
std::cout << "Nissan" << std::endl;
director.setBuilder(&nissanBuilder); // using NissanBuilder instance
car = director.getCar();
car->specifications();
return 0;
}
示例2: main
/*
main()
//*/
int main()
{
using namespace std;
// init
cout << "init..\n";
Director director;
std::auto_ptr< Product > product;
cout << endl;
// builder A
cout << "builder A\n";
ConcreteBuilderA concBuilderA;
director.setBuilder( &concBuilderA);
director.construct();
product = director.getProduct();
product->showProduct();
cout << endl;
// builder B
cout << "builder B\n";
ConcreteBuilderB concBuilderB;
director.setBuilder( &concBuilderB);
director.construct();
product = director.getProduct();
product->showProduct();
cout << endl;
cout << "READY.\n";
return 0;
}
示例3: main
int main()
{
Korean korean;
American american;
Director director;
director.setBuilder(&korean);
cout << director.construct() << endl;
director.setBuilder(&american);
cout << director.construct() << endl;
}
示例4: main
int main()
{
Builder * builder = new ConcreteBuilder();
Director director;
director.setBuilder(builder);
Product *pd = director.constuct();
pd->show();
delete builder;
delete pd;
return 0;
}
示例5: main
int main()
{
Director d; //GoF ���Ͽ��� ������
Korea k;
Spain s; // ������.. �� �����!!
d.setBuilder(&s); //����ڰ� ij���� ���� ȭ��ǥ Ű��
// ������...
Character c = d.Construct();
cout << c << endl;
}
示例6: main
int main()
{
using namespace BUILDER;
Director directot;
cout << "Build paper." << endl;
directot.setBuilder(new PaperBuilder());
directot.createProduct();
Product& paperPrd = directot.getProduct();
paperPrd.showProduct();
cout << "Build usa." << endl;
directot.setBuilder(new UsaBuilder());
directot.createProduct();
Product& usaPrd = directot.getProduct();
usaPrd.showProduct();
getchar();
return 0;
}
示例7: main
int main() {
Director* d = new Director();
d->setBuilder(new dfBuilder());
d->orderCake("sacher");
d->orderCake("tresLeches");
d->orderCake("imposible");
d->orderCake("imposible");
d->orderCake("imposible");
d->printCakes();
std::cout << "Tenemos " << d->getCakesCount() << " pasteles" << std::endl;
std::cout << "Hay un imposible en la posicion " << d->searchCake("imposible") << std::endl;
d->searchCake("tresLeches");
return 0;
}