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

给一个网站怎么做安全测试就业seo好还是sem

给一个网站怎么做安全测试,就业seo好还是sem,如何高效建设品牌网站?,一般网站服务费怎么入账做分录文章目录 一、定义抽象产品接口二、定义抽象工厂接口三、定义具体产品四、定义具体工厂五、定义工厂客户端六、客户端调用工厂客户端七、抽象工厂模式的结构 一、定义抽象产品接口 //------------------------------------------------------------------ //| 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://www.dinnco.com/news/5423.html

相关文章:

  • 新津网站建设zoho crm
  • ps制作网站导航图片系统开发
  • 钓鱼网站怎么做网站建设开发简介
  • 高端网站建设企业公司seo课程简介
  • ecshop的301重定向优化插件解决伪静态后重复页面提高网站权重广州关键词快速排名
  • 关于网站开发制作的相关科技杂志的网站网络营销所学课程
  • 龙岗住房和建设局网站官网线上培训平台
  • 2018钓鱼网站建设seo招聘信息
  • 做外语网站的公司网络优化工程师吃香吗
  • 长沙网站建设网店怎么推广和宣传
  • 广元网站建设价格高端网站建设企业
  • 网站建设与开发的收获与体会重庆网络推广专员
  • java 网站开发开源抖音代运营公司
  • eclipse做购物网站百度账号登录
  • 昆明网站建设公司哪家好台州seo排名扣费
  • 别人帮做的网站怎么修改病句收录网
  • wordpress网页北京seo公司wyhseo
  • seo网站运营网站怎么推广
  • 网址地址seo分析师
  • 惠州网站建设制作郑州模板网站建设
  • 网站域名需icp备案市场推广方案范文
  • 张店做网站正规的培训学校
  • wordpress菜单目录层叠重庆自动seo
  • 泉州网站建站模板晚上偷偷看b站软件推荐
  • 合肥企业网站seo如何优化图片
  • 门户网站欣赏如何制作百度网页
  • 海纳企业网站建设网站设计用什么软件
  • 太原市给企业做网站游戏推广公司靠谱吗
  • 开发者模式伤手机吗而的跟地seo排名点击软件
  • sns社交网站开发新闻发布平台