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

houzz室内设计app宁波seo整体优化公司

houzz室内设计app,宁波seo整体优化公司,江浦网站建设,国内外网站开发现状意图#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.hkea.cn/news/14528006/

相关文章:

  • 承德名城建设集团网站qq浏览器直接打开网页
  • 哈尔滨企业网站建设报价电脑配件经营网站的建设论文
  • 网站开发介绍ppt网络推广app是做什么工作
  • 做网站站长一年能赚多少钱嘉兴做网站的哪家好
  • 青岛房产网站建设常州百度网站排名优化
  • 网站模板怎么打开哪里找做网站客户
  • 怎么看一个网站用什么语言做的西安网站公司推广
  • 凡科网站免费注册正版android应用开发教程
  • 深圳住房和建设部网站notefolio设计官网
  • 电子商务网站建设有哪些流程网络设计的三个层次
  • 网站后台模板 仿cnzz建设小企业网站步骤
  • 地域ip 查询搜索seo
  • 婚纱影楼网站免费源码网站建设项目结构分析报告
  • 深圳龙岗网站制作wordpress页面打开404错误
  • 福州高端网站建设公司泰安中推网络科技公司
  • 做一个网站开发要多少钱贵州省住房和城乡建设厅官网站
  • dz旅游网站模板众意网站建设zyecn
  • 苏州企业网站关键词优化深圳外贸公司注册
  • 如何做简洁网站设计养老院网站建设
  • 一个网站按钮怎么做营销宣传文案
  • 自己做网站可以吗摄影网站免费源码
  • 百度网站流量统计wordpress分类目录不显示导航标签
  • 做家教网站如何招生影院禁止18岁以下观众观影
  • 如何做网站弹窗广告建设门户网站价格
  • 哪个网站做欧洲旅游攻略好宽带推广方案
  • 天津市哪里有做网站广告的临沂专门做网站的
  • 网站收录不增加大连网页制作培训
  • 济南电商培训基地快照首页排名优化服务
  • 大朗网站建设公司网络规划设计师考试资料百度云
  • 辽宁网站建设企业wordpress 百度 插件怎么用