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


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

本文整理汇总了C++中Director::Construct方法的典型用法代码示例。如果您正苦于以下问题:C++ Director::Construct方法的具体用法?C++ Director::Construct怎么用?C++ Director::Construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Director的用法示例。


在下文中一共展示了Director::Construct方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main( int argc, char* argv[] )
{
	Builder* b =   new ConcreteBuilder();
	Director* d = new Director(b);
	d->Construct();
	b->GetProduct();

	return 0;
}
开发者ID:pengdu,项目名称:code-snippet,代码行数:9,代码来源:main.cpp

示例2: main

int main(int argc, char *argv[])
{
	Director* pDirector = new Director(new ConcreteBuilder1());
	pDirector->Construct();

	Director* pDirector1 = new Director(new ConcreteBuilder2());
	pDirector1->Construct();
    return 0;
}
开发者ID:dsqiu,项目名称:qzystudy,代码行数:9,代码来源:builder.cpp

示例3: main

int main(int argc, char* argv[])
{
	Product* pro;//接收产品的指针
	//将一个具体的构建者付给指挥者
	Director* d = new Director(new ConcreteBuilder());
	pro=d->Construct();//调用产生产品
	pro->fun();
	printf("Hello World!\n");
	return 0;
}
开发者ID:greenpea1121,项目名称:DesignPatternExample,代码行数:10,代码来源:Builder_exam.cpp

示例4: main1

//builder.h
int main1()
{
    Director* pDirector = new Director(new ConcreteBuilder1());
    pDirector->Construct();

    Director* pDirector1 = new Director(new ConcreteBuilder2());
    pDirector1->Construct();

    return 0;
}
开发者ID:ircc,项目名称:test-code-backup,代码行数:11,代码来源:builder_test.cpp

示例5: test_builder

void test_builder()
{
	Builder* bld = new ConcreteBuilder;
	Director* dct = new Director(bld);
	dct->Construct();

	ProductBuild* pdt = bld->GetProduct();
	pdt->Show();

	delete bld;
	delete dct;
}
开发者ID:lvpingjie,项目名称:design_pattern,代码行数:12,代码来源:test.cpp

示例6: 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

示例7: main

int main()
{
	Director* director = new Director();
	Builder* b1 = new ConcreteBuilder1();
	Builder* b2 = new ConcreteBuilder2();

	director->Construct(b1);
	Product* p1 = b1->GetResult();
	p1->Show();

	std::cin.get();
	return 0;
}
开发者ID:yaoqingyuan,项目名称:DesignPatterns,代码行数:13,代码来源:main.cpp

示例8: main

int main(int argc, char *argv[])
{
	Product* product = new Product();
	Build *build = new ConcreteBuild(product);
    Director *directot = new Director(build);
	directot->Construct();
	vector<string>::iterator ite;
	for(ite = product->vec.begin();ite != product->vec.end(); ++ite)
	{
		cout << *ite << endl;
	}
    return 0;
}
开发者ID:Addision,项目名称:DesignPattern,代码行数:13,代码来源:Test.cpp

示例9: main

int main()
{
	// Create director and builders
	Director* lpDirector = new Director;

	Builder* lpBuilder1 = new ConcreteBuilder1;
	Builder* lpBuilder2 = new ConcreteBuilder2;

	// Construct two products
	lpDirector->Construct(lpBuilder1);
	Product* lpProduct1 = lpBuilder1->GetResult();
	lpProduct1->Show();

	lpDirector->Construct(lpBuilder2);
	Product* lpProduct2 = lpBuilder2->GetResult();
	lpProduct2->Show();

	// Wait for user
	int input;
	cin >> input;

	return 0;
}
开发者ID:iljfor,项目名称:GOFDesignPattern,代码行数:23,代码来源:MainApp.cpp

示例10: main

int main(int argc,char* argv[])
{
    QApplication app(argc,argv);
    factoryModel style = EPAbstractFactory;

    if (style == EPEffective)
    {
        Shape *pr = new Rectangle;
        pr->draw();
        pr->draw(Shape::Green);

        Shape *pc = new Circle;
        pc->draw(Shape::Blue);
    } else if (style == EPFactory)
    {
        Factory *fac = new ConcreteFactory();
        Product *p = fac->CreateProduct();
        delete p;
    } else if (style == EPBuilder )
    {
        Director* d = new Director(new ConcreteBuilder());
        d->Construct();
    } else if (style == EPAbstractFactory)
    {
        AbstractFactory *cf1 = new ConcreteFactory1();
        cf1->CreateProductA();
        cf1->CreateProductB();

        AbstractFactory *cf2 = new ConcreteFactory2();
        cf2->CreateProductA();
        cf2->CreateProductB();
        int *p = NULL;
        int x = 10;
        p = &x;
        ConcreteFactory2 *cf3 = (ConcreteFactory2*)cf2;
        cf3->create(p);
    }

    return app.exec();
}
开发者ID:chen12nan,项目名称:customlib,代码行数:40,代码来源:main.cpp

示例11: BuilderTest

///当我们要创建的对象很复杂的时候(通常是 由很多其他的对象组合而成),我们要要复杂对象的创建过程和这个对象的表示(展示)分 离开来,这样做的好处就是通过一步步的进行复杂对象的构建,由于在每一步的构造过程中 可以引入参数,使得经过相同的步骤创建最后得到的对象的展示不一样
///Builder 建造者模式和 AbstractFactory 模式在功能上很相似,因为都是用来创建大的复杂的对 象,它们的区别是:Builder 模式强调的是一步步创建对象,并通过相同的创建过程可以获 得不同的结果对象,一般来说 Builder 模式中对象不是直接返回的。而在 AbstractFactory 模 式中对象是直接返回的,AbstractFactory 模式强调的是为创建多个相互依赖的对象提供一个 同一的接口。
void BuilderTest() {
    Director* d = new Director(new ConcreteBuilder());
    d->Construct();
}
开发者ID:chenxin0123,项目名称:Demos,代码行数:6,代码来源:main.cpp

示例12: main

int main(int argc,char* argv[]) 
{
	Director* d = new Director(new ConcreteBuilder());
	d->Construct();
	return 0; 
}
开发者ID:ircc,项目名称:test-code-backup,代码行数:6,代码来源:main.cpp


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