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

flash网站建设教程工贸一体化企业建设电子商务网站的误区

flash网站建设教程,工贸一体化企业建设电子商务网站的误区,wordpress 红色模版,wordpress小程序模版意图#xff1a;将对象组成树状结构以表示“部分#xff0d;整体”的层次结构#xff0c;使得Client对单个对象和组合对象的使用具有一致性。 上下文#xff1a;在树型结构的问题中#xff0c;Client必须以不同的方式处理单个对象和组合对象。能否提供一种封装#xff0c… 意图将对象组成树状结构以表示“部分整体”的层次结构使得Client对单个对象和组合对象的使用具有一致性。 上下文在树型结构的问题中Client必须以不同的方式处理单个对象和组合对象。能否提供一种封装统一简单元素和复杂元素的概念让对象容器自己来实现自身的复杂结构让Client可以像处理简单元素一样来处理复杂元素从而使Client与复杂元素的内部结构解耦 UML Component为Composite中的对象声明接口在适当情况下实现所有类公共接口的默认行为声明一个接口用于访问和管理Component的子部件在递归结构中定义一个接口用于访问一个父部件并在适当的情况下实现它。 Leaf在Composite中表示叶子对象。 Composite存储子部件并定义有子部件的那些部件的行为。 Client通过Component接口操作Composite的对象。 代码 #include iostream #include list using namespace std;class Component { public:string name;Component(string name):name(name){}virtual void add(Component *c) 0;virtual void remove(Component *c) 0;virtual void display(int depth) 0; };class Leaf:public Component { public:// Component interfaceLeaf(string name):Component(name){} public:void add(Component *c);void remove(Component *c);void display(int depth); };void Leaf::add(Component *c ) {(void)(c);//消除警告cout 不能向叶子中添加Component endl; }void Leaf::remove(Component *c) {(void)(c);//Warningcout 不能从叶子中删除Component endl; }void Leaf::display(int depth) {cout string(depth,-) this-name endl; }class Composite:public Component { public:listComponent* children;// Component interfaceComposite(string name):Component(name){} public:void add(Component *c);void remove(Component *c);void display(int depth); }; void Composite::add(Component *c) {children.push_back(c); }void Composite::remove(Component *c) {children.remove(c); }void Composite::display(int depth) {cout string(depth,-) this-name endl;listComponent*::iterator it;for(it children.begin();it ! children.end();it){Component *c *it;c-display(depth 2);} } int main() {Composite *root new Composite(树干);root-add(new Leaf(树叶1));root-add(new Leaf(树叶2));Composite *c1 new Composite(树枝1);c1-add(new Leaf(树叶1-1));c1-add(new Leaf(树叶1-2));root-add(c1);Composite *c1_1 new Composite(树枝1-1);c1_1-add(new Leaf(树叶1-1-1));c1_1-add(new Leaf(树叶1-1-2));c1-add(c1_1);root-add(new Leaf(树叶3));root-display(1);return 0; }结果 -树干 ---树叶1 ---树叶2 ---树枝1 -----树叶1-1 -----树叶1-2 -----树枝1-1 -------树叶1-1-1 -------树叶1-1-2 ---树叶3
http://www.pierceye.com/news/244148/

相关文章:

  • 代理网址网站与做机器人有关的网站
  • 优惠卷网站怎么做推广歌手网站建设
  • 网站服务器开发西安app软件开发公司
  • 化妆品产品的自建网站哟哪些怎么做提升网站转化率
  • 上海餐饮网站建设百度本地推广
  • 全返网站建设做pc端网站信息
  • 做团购网站需要什么网站建设与管理好处
  • 厦门seo优泰安网站seo推广
  • 做网站如何盈利建站优化信息推广
  • 大气的网站首页网络推广公司优化客
  • 网站建设要经历哪些步骤电商仓储代发招商合作
  • 网站开发如何搭建框架潍坊网站建设公司
  • 免费网页制作网站建设2015年做啥网站致富
  • 个人网站制作基本步骤江阴网站的建设
  • 英文网站名需要斜体吗宁波seo外包费用
  • 网站设计价格公司门户网站建设
  • wordpress如何修改文章路径哈尔滨个人优化排名
  • 拓者设计吧网站科技基金
  • 有专门下载地图做方案的网站吗家装公司报价
  • 阿里域名注册网站阿里云建站保证销售额
  • 三北防护林体系建设网站培训班学员培训心得
  • 西安百度网站排名优化友情链接代码模板
  • 网站建设怎么做网站济南做网站推广有哪些公司
  • 恩阳建设局网站南阳网站建设赛科
  • 服务器IP做网址打开网站传媒公司宣传
  • 安装Wordpress个人网站医院网站建设公司价格低
  • 万能网页编辑器南通百度seo代理
  • 关于酒店网站建设的摘要手机百度2020
  • 楚雄网站建设rewlkj自己怎么建立个人网站
  • 网站开发工程师工作描述加强门户网站建设与管理办法