当前位置: 首页 > news >正文

网站开发 卓优科技做电影种子下载网站违法吗

网站开发 卓优科技,做电影种子下载网站违法吗,文化墙设计网站推荐,网站制作和app制作文章目录 一、定义抽象产品接口二、定义抽象工厂接口三、定义具体产品四、定义具体工厂五、定义工厂客户端六、客户端调用工厂客户端七、抽象工厂模式的结构 一、定义抽象产品接口 //------------------------------------------------------------------ //| participants … 文章目录 一、定义抽象产品接口二、定义抽象工厂接口三、定义具体产品四、定义具体工厂五、定义工厂客户端六、客户端调用工厂客户端七、抽象工厂模式的结构 一、定义抽象产品接口 //------------------------------------------------------------------ //| participants | //------------------------------------------------------------------ // abstract product declares an interface for a type of products //------------------------------------------------------------------ //| participants abstract product | //------------------------------------------------------------------ interface AbstractProductA{}; //------------------------------------------------------------------ //| participants abstract product | //------------------------------------------------------------------ interface AbstractProductB{void Interact(AbstractProductA*);}; 二、定义抽象工厂接口 //------------------------------------------------------------------ //| participants | //------------------------------------------------------------------ interface AbstractFactory // declares an interface for operations that create abstract products {AbstractProductA* CreateProductA(void);AbstractProductB* CreateProductB(void); }; 三、定义具体产品 //------------------------------------------------------------------ //| participants | //------------------------------------------------------------------ // concrete product // defines product object to be created by concrete factory // implements abstract product interface //------------------------------------------------------------------ //| participants concrete product | //------------------------------------------------------------------ class ProductA1:public AbstractProductA {public:ProductA1(void); }; void ProductA1::ProductA1(void) {Print(product a1 constructed);} //------------------------------------------------------------------ //| participants concrete product | //------------------------------------------------------------------ class ProductA2:public AbstractProductA {public:ProductA2(void); }; void ProductA2::ProductA2(void) {Print(product a2 constructed);} //------------------------------------------------------------------ //| participants concrete product | //------------------------------------------------------------------ class ProductB1:public AbstractProductB {public:ProductB1(void);void Interact(AbstractProductA*); }; void ProductB1::ProductB1(void) {Print(product b1 constructed);} void ProductB1::Interact(AbstractProductA*src) {Print(product b1: ,this, is interacting with product a: ,src); } //------------------------------------------------------------------ //| participants concrete product | //------------------------------------------------------------------ class ProductB2:public AbstractProductB {public:ProductB2(void);void Interact(AbstractProductA*); }; void ProductB2::ProductB2(void) {Print(product b2 constructed);} void ProductB2::Interact(AbstractProductA*src) {Print(product b2: ,this, is interacting with product a: ,src); } // // 四、定义具体工厂 //------------------------------------------------------------------ //| participants | //------------------------------------------------------------------ // concrete factory implements operations create concrete products //------------------------------------------------------------------ //| participants concrete factory | //------------------------------------------------------------------ class Factory1:public AbstractFactory {public:Factory1(void);AbstractProductA* CreateProductA(void);AbstractProductB* CreateProductB(void); }; //------------------------------------------------------------------ //| participants concrete factory factory 1 | //------------------------------------------------------------------ void Factory1::Factory1(void) {Print(factory 1: ,this, constructed); } //------------------------------------------------------------------ //| participants concrete factory factory 1 | //------------------------------------------------------------------ AbstractProductA* Factory1::CreateProductA(void) {printf(factory 1 is creating and returning product a1);return new ProductA1; } //------------------------------------------------------------------ //| participants concrete factory factory 1 | //------------------------------------------------------------------ AbstractProductB* Factory1::CreateProductB(void) {printf(factory 1 is creating and returning product b1);return new ProductB1; } //------------------------------------------------------------------ //| participants concrete factory | //------------------------------------------------------------------ class Factory2:public AbstractFactory {public:Factory2(void);AbstractProductA* CreateProductA(void);AbstractProductB* CreateProductB(void); }; //------------------------------------------------------------------ //| participants concrete factory factory 2 | //------------------------------------------------------------------ void Factory2::Factory2(void) {Print(factory 2: ,this, constructed); } //------------------------------------------------------------------ //| participants concrete factory factory 2 | //------------------------------------------------------------------ AbstractProductA* Factory2::CreateProductA(void) {printf(factory 2 is creating and returning product a2);return new ProductA2; } //------------------------------------------------------------------ //| participants concrete factory factory 2 | //------------------------------------------------------------------ AbstractProductB* Factory2::CreateProductB(void) {printf(factory 2 is creating and returning product b2);return new ProductB2; }五、定义工厂客户端 //------------------------------------------------------------------ //| participants | //------------------------------------------------------------------ class FactoryClient // uses interfaces declared by abstract factory, abstract product {public:void Run(void);void Switch(AbstractFactory*);FactoryClient(AbstractFactory*);~FactoryClient(void);protected:AbstractProductA* apa;AbstractProductB* apb;AbstractFactory* factory;void Delete(void); }; //------------------------------------------------------------------ //| participants factory client | //------------------------------------------------------------------ void FactoryClient::FactoryClient(AbstractFactory* af) {Print(factory client created and received abstract factory ,af);Print(factory client is requesting to accept/switch the factories);Switch(af); } //------------------------------------------------------------------ //| participants factory client | //------------------------------------------------------------------ void FactoryClient::~FactoryClient(void) {Delete(); } //------------------------------------------------------------------ //| participants factory client | //------------------------------------------------------------------ void FactoryClient::Run(void) {Print(factory client is running abstract product b);apb.Interact(apa); } //------------------------------------------------------------------ //| participants factory client | //------------------------------------------------------------------ void FactoryClient::Delete(void) {delete apa;delete apb;delete factory; } //------------------------------------------------------------------ //| participants factory client | //------------------------------------------------------------------ void FactoryClient::Switch(AbstractFactory *af) {string sFactory;StringConcatenate(sFactory,sFactory,factory);int iFactory(int)StringToInteger(sFactory);if(iFactory0){Print(factory client is switching old factory ,factory, to new factory ,af);}else{Print(factory client is accepting new factory ,af);}Delete();factoryaf;Print(factory client saved the new factory);Print(factory client is requesting its new factory to create product a);apafactory.CreateProductA();Print(factory client is requesting its new factory to create product b);apbfactory.CreateProductB(); } 六、客户端调用工厂客户端 //------------------------------------------------------------------ //| interface for patterns | //------------------------------------------------------------------ interface ClientExample //pattern client {string Output(void); //returns headervoid Run(void); //execute the pattern client };//------------------------------------------------------------------ //| participants | //------------------------------------------------------------------ class Client:public ClientExample{ public:string Output(void);void Run(void);}; string Client::Output(void) {return __FUNCTION__;} //------------------------------------------------------------------ //| collaborations | //------------------------------------------------------------------ void Client::Run(void) // concrete factory // a single instance normally created at run-time // creates products with particular implementation // client uses other factory for different product objects // abstract factory // defers creation product objects concrete factory subclass{Print(client is requesting to create factory 1);Print(client is requesting to create the factory client);Print(client is requesting the factory client to manage factory 1);FactoryClient client(new Factory1);Print(client is requesting the factory client to operate);client.Run();Print(client is requesting to create new factory 2 and asking factory client to switch factories);client.Switch(new Factory2);Print(client is requesting the factory client to run again);client.Run();} } 七、抽象工厂模式的结构 //------------------------------------------------------------------ //| structure | //------------------------------------------------------------------ // // | AbstractFactory|-----------------------------------------|Client| // |----------------| | // |CreateProductA()| | // |CreateProductA()| |AbstractProductA|------- // ^ ^ | // | | | // --------------------- ---------- | // | | | | | //|ConcreteFactory1|- |ConcreteFactory2|- -|ProductA2| |ProductA1|- | //|----------------| | |----------------| | | | //|CreateProductA()| |CreateProductA()| | //|CreateProductB()| | |CreateProductB()| | | | // |AbstractProductB|------ // | | ^ | // | // | | ---------- | // | | // | -|ProductB2| |ProductB1|- // | // - - - - - - - - - - - - - - - - - - - - - - - - -
http://www.hkea.cn/news/14593503/

相关文章:

  • 网站内页做排名网站域名设计方案
  • 西安买公司的网站建设曲靖做网站需要多少钱
  • 全球招商网网络优化策划书
  • 上海金山网站设计公司鲜花网站建设
  • 天河建设网站专家收款后自动发货的网站是怎么做的
  • 自己制作一个网站的软件app如何制作(怎么自己做app)
  • 普集网站制作营销策划与运营
  • 湖南省建设资源人才网站wordpress图片下一张
  • 我的世界寻找建筑网站网站如何做收款二维码
  • 东莞视频网站制作网上怎么开自己的网店呀
  • 照明灯企业网站织梦模板青岛免费建网站
  • 个人博客网站怎么赚钱旅游攻略那个网站做的好
  • 网站建设的缺点怎么做一个门户网站
  • 创建大型网站夫唯seo系统培训
  • 深圳网站建设 培训单一产品企业或多元化产品企业的网站建设与策划有什么不同?
  • php 公司网站wordpress设计师
  • vps云主机可以做网站wordpress消息通知
  • 网站建设采用的技术app模板素材下载
  • 公司建设网站费用属于什么费用吗网页升级紧急通知app
  • 什么牛网站建设北京移动网站建设
  • 做网站经常用的字体有哪些网站建设规划书ppt
  • 小程序定制开发的公司网站如何做seo优化
  • 网站制作流程有哪些步骤?wordpress运行php
  • 优良网站能免费建设网站吗
  • 网站的设计分析南京网络营销课程培训
  • 网站推广途径和要点济南外贸网站制作
  • 搜狗引擎网站收录如何批量建网站
  • 青岛胶南做网站的网站收录免费咨询
  • 番禺区大石做网站docker查看wordpress
  • 长沙那个手机建网站公司好wordpress系统很卡