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

2021年建站赚钱树枝seo

2021年建站赚钱,树枝seo,分类建站cms系统,做手机网站价格目录 C设计模式-装饰器(Decorator) 一、意图 二、适用性 三、结构 四、参与者 五、代码 C设计模式-装饰器(Decorator) 一、意图 动态地给一个对象添加一些额外的职责。就增加功能来说,Decorator模式相比生成子…

目录

C++设计模式-装饰器(Decorator)

一、意图

二、适用性

三、结构

四、参与者

五、代码


C++设计模式-装饰器(Decorator)

一、意图

动态地给一个对象添加一些额外的职责。就增加功能来说,Decorator模式相比生成子类更为灵活。

二、适用性

  • 在不影响其他对象的情况下,以动态、透明的方式给单个对象添加职责。
  • 处理那些可以撤消的职责。
  • 当不能采用生成子类的方法进行扩充时。一种情况是,可能有大量独立的扩展,为支持每一种组合将产生大量的子类,使得子类数目呈爆炸性增长。另一种情况可能是因为类定义被隐藏,或类定义不能用于生成子类。

三、结构

 

四、参与者

  • Component

        定义一个对象接口,可以给这些对象动态地添加职责。

  • ConcreteDecorator

       定义一个对象,可以给这个对象添加一些职责。

  • Decorator

        维持一个指向Component对象的指针,并定义一个与Component接口一致的接口。

  • ConcreteComponent

        向组件添加职责。

五、代码

#include<iostream>
using namespace std;class Component {
public:virtual void Operation() = 0;
};class ConcreteComponent : public Component{
public:virtual void Operation() {cout << "ConcreteComponent" << endl;}
};class Decorator : public Component {
public:Decorator(Component* tempComponent) :component(tempComponent) {}virtual void Operation() {component->Operation();}
private:Component* component;
};class ConcreteDecoratorA : public Decorator {
public:ConcreteDecoratorA(Component* tempComponent) :Decorator(tempComponent) {}virtual void Operation() {Decorator::Operation();cout << "ConcreteDecoratorA" << endl;}
};class ConcreteDecoratorB : public Decorator {
public:ConcreteDecoratorB(Component* tempComponent) :Decorator(tempComponent) {}virtual void Operation() {Decorator::Operation();cout << "ConcreteDecoratorB" << endl;}
};int main() {Component* component = new ConcreteComponent;component->Operation();Component* componentA = new ConcreteDecoratorA(component);componentA->Operation();Component* componentB = new ConcreteDecoratorB(component);componentB->Operation();return 0;
}

http://www.dinnco.com/news/18611.html

相关文章:

  • 广东高端网站设计公司价格关键词难易度分析
  • wordpress 网站优化景德镇seo
  • 怎么制作网站教程图片快速建站网站
  • 给企业做网站的公司西安信息推广平台
  • 经营阅读网站需要怎么做搜索引擎搜索
  • 提供服务器和网站建设潍坊快速网站排名
  • 为什么我自己做的网站百度不到关键词采集网站
  • 厦门网站建设的公司哪家好整站优化代理
  • 沈阳做网站比较好的公司2023b站推广大全
  • 门户网站建设 请示20条优化措施
  • 网站英文域名怎么查青岛网站建设方案
  • 小说网站流量怎么做seo网站推广软件 快排
  • wordpress 设置文章模板seo是什么
  • 商城手机网站制作深圳百度推广优化
  • 南昌做网站开发的公司哪家好搜索广告排名
  • 做qq头像的网站广州营销型网站
  • 做企业网站用哪个cms百度竞价推广点击器
  • dw用ps切片做网站sem什么意思
  • 企业站用什么程序做网站广州网站优化推广方案
  • 做网站常德怎么做好网络推广销售
  • wan网站建设怀化seo推广
  • 网站怎么做 织梦天津推广的平台
  • 东莞企石网站设计核心关键词
  • 做一个网站需要到哪里做怎么做公司网页
  • 电子商务网站建设与管理的背景阿里云搜索引擎
  • 南川网站制作品牌策划方案模板
  • 企业公司网站制作建设郑州专业seo推荐
  • o2o网站开发上海建站seo
  • 怎么给网站做api网络推广需要多少费用
  • wix网站做seo如何站长统计网站统计