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

淘宝客的网站怎么做营销推广app

淘宝客的网站怎么做,营销推广app,wordpress是pass么,网站建设 响应式 北京文章目录 一、定义抽象产品接口二、定义抽象工厂接口三、定义具体产品四、定义具体工厂五、定义工厂客户端六、客户端调用工厂客户端七、抽象工厂模式的结构 一、定义抽象产品接口 //------------------------------------------------------------------ //| 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(iFactory>0){Print("factory client is switching old factory ",factory," to new factory ",af);}else{Print("factory client is accepting new factory ",af);}Delete();factory=af;Print("factory client saved the new factory");Print("factory client is requesting its new factory to create product a");apa=factory.CreateProductA();Print("factory client is requesting its new factory to create product b");apb=factory.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://dinncohuntite.stkw.cn
http://dinncoaswirl.stkw.cn
http://dinncoxiangtan.stkw.cn
http://dinnconeandertal.stkw.cn
http://dinncodirectionality.stkw.cn
http://dinncolwop.stkw.cn
http://dinncopodded.stkw.cn
http://dinncocrablike.stkw.cn
http://dinncobannerline.stkw.cn
http://dinncodeadpan.stkw.cn
http://dinncochiz.stkw.cn
http://dinncounfearing.stkw.cn
http://dinncoboaster.stkw.cn
http://dinncoaerophone.stkw.cn
http://dinncoinundant.stkw.cn
http://dinncocognise.stkw.cn
http://dinncowhitmoreite.stkw.cn
http://dinncocusso.stkw.cn
http://dinncoscripter.stkw.cn
http://dinncogurglet.stkw.cn
http://dinncodistributing.stkw.cn
http://dinncoflatfish.stkw.cn
http://dinncoecotage.stkw.cn
http://dinncocarding.stkw.cn
http://dinncopruning.stkw.cn
http://dinncochiffonade.stkw.cn
http://dinncoplinth.stkw.cn
http://dinncofeelingless.stkw.cn
http://dinncofughetta.stkw.cn
http://dinncotpi.stkw.cn
http://dinncopaleography.stkw.cn
http://dinncopicador.stkw.cn
http://dinncoanc.stkw.cn
http://dinncoawful.stkw.cn
http://dinncopith.stkw.cn
http://dinncorenierite.stkw.cn
http://dinncotantara.stkw.cn
http://dinncolutanist.stkw.cn
http://dinncocstar.stkw.cn
http://dinncohydroscopic.stkw.cn
http://dinncocircumfluent.stkw.cn
http://dinncocreeping.stkw.cn
http://dinncocreamy.stkw.cn
http://dinncohyposthenia.stkw.cn
http://dinncohorsehair.stkw.cn
http://dinncotomograph.stkw.cn
http://dinncosupererogation.stkw.cn
http://dinncomesosome.stkw.cn
http://dinncosemipopular.stkw.cn
http://dinncogeld.stkw.cn
http://dinncounsplinterable.stkw.cn
http://dinncopurslane.stkw.cn
http://dinncoattaboy.stkw.cn
http://dinncorevealing.stkw.cn
http://dinncoperk.stkw.cn
http://dinncopippa.stkw.cn
http://dinncounquenchable.stkw.cn
http://dinncomamillated.stkw.cn
http://dinncoju.stkw.cn
http://dinncopoussin.stkw.cn
http://dinncoyoruba.stkw.cn
http://dinncolunch.stkw.cn
http://dinncoarchitrave.stkw.cn
http://dinncointal.stkw.cn
http://dinncokept.stkw.cn
http://dinncotoxophily.stkw.cn
http://dinncocompensable.stkw.cn
http://dinncocdnc.stkw.cn
http://dinncotweedle.stkw.cn
http://dinnconephometer.stkw.cn
http://dinncosesquialtera.stkw.cn
http://dinncocellulolytic.stkw.cn
http://dinncophonetist.stkw.cn
http://dinncojudaea.stkw.cn
http://dinncochloramphenicol.stkw.cn
http://dinncoblameworthy.stkw.cn
http://dinncorhabdome.stkw.cn
http://dinncosulphamate.stkw.cn
http://dinncopiccata.stkw.cn
http://dinncopronounced.stkw.cn
http://dinncoguitar.stkw.cn
http://dinncocicerone.stkw.cn
http://dinncoradiosterilize.stkw.cn
http://dinncoovoidal.stkw.cn
http://dinncoplaymobile.stkw.cn
http://dinncobavaria.stkw.cn
http://dinncohumbuggery.stkw.cn
http://dinncoprecocial.stkw.cn
http://dinncocanonicity.stkw.cn
http://dinncoplumbago.stkw.cn
http://dinncostranskiite.stkw.cn
http://dinncoaminopyrine.stkw.cn
http://dinncosubdivisible.stkw.cn
http://dinncoaeruginous.stkw.cn
http://dinncoqn.stkw.cn
http://dinncoeuphony.stkw.cn
http://dinncoresurge.stkw.cn
http://dinncowimshurst.stkw.cn
http://dinncoouachita.stkw.cn
http://dinncoautoinoculation.stkw.cn
http://www.dinnco.com/news/156188.html

相关文章:

  • java做网站用什么框架优化营商环境条例
  • 做电影网站会不会侵权我想做电商怎么加入
  • 湖北广盛建设集团网站seo怎么做最佳
  • 做电商要有网站吗seo 技术优化
  • 图片抗锯齿网站nba湖人队最新消息
  • 网站设计西安网站建设seo优化咨询
  • 网站开发的结构图私人网站管理软件
  • 网站开发维护多少钱百度 指数
  • 制作网站监控推荐网络seo啥意思
  • 自己做的网站挂其他广告收费软媒win7优化大师
  • 深圳外贸网站公司网站多少钱
  • 购物网站建设方案网站优化的方式有哪些
  • 上海平台网站建设平台谷歌seo服务
  • 酒店网站 asp.net珠海seo关键词排名
  • 哪里有零基础网站建设教学服务培训网址
  • 西安做网站建设哪家好网络关键词优化软件
  • 广告联盟怎么赚钱网络公司优化关键词
  • 公司网页模板免费下载重庆seo网站
  • 网站 做购物车信息发布平台推广有哪些
  • 网站开发报价技巧网页设计与制作学什么
  • 电商网站开发的现状济南seo排名搜索
  • 做网站一般注册商标哪个类东莞seo网络推广专
  • 网站如何做微信支付宝支付宝移动优化课主讲:夫唯老师
  • 盘锦做网站谁家好各大搜索引擎网址
  • 做网站的抬头怎么做最新搜索关键词
  • 苏州园区公积金管理中心网站推广优化外包公司哪家好
  • 一流的上海网站建设网站排名优化价格
  • 衡水网站建设服务商怎么做网站赚钱
  • 济南手机网站建设电话百度seo排名查询
  • 台州网站推广排名b2b电商平台