当前位置: 首页>>代码示例>>C++>>正文


C++ Director::setBuilder方法代码示例

本文整理汇总了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;
}
开发者ID:rajendrauppal,项目名称:gists,代码行数:27,代码来源:CarBuilder.cpp

示例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;
}
开发者ID:Rubusch,项目名称:cpp,代码行数:34,代码来源:builder.cpp

示例3: main

int main()
{
	Korean korean;
	American american;
	Director director;

	director.setBuilder(&korean);
	cout << director.construct() << endl;

	director.setBuilder(&american);
	cout << director.construct() << endl;
}
开发者ID:goodgodgd,项目名称:DesignPatternCpp,代码行数:12,代码来源:7_1_빌더_기본패턴.cpp

示例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;
}
开发者ID:DavidL92,项目名称:Try,代码行数:12,代码来源:builder.cpp

示例5: main

int main()
{
	Director d; //GoF ���Ͽ��� ������
	Korea k;
	Spain s; // ������.. �� �����!!

	d.setBuilder(&s); //����ڰ� ij���� ���� ȭ��ǥ Ű��
					  // ������...

	Character c = d.Construct();
	cout << c << endl;

}
开发者ID:CppKorea,项目名称:DesignPatternStudy,代码行数:13,代码来源:Builder5.cpp

示例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;
}
开发者ID:gogowishfly,项目名称:Design-Pattern-Sample-Code,代码行数:22,代码来源:Builder.cpp

示例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;
}
开发者ID:osanseviero,项目名称:Software_Engineering,代码行数:14,代码来源:main.cpp


注:本文中的Director::setBuilder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。