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

网站站内搜索制作做推文的网站知乎

网站站内搜索制作,做推文的网站知乎,新手可以做网站营运吗,做语文题的网站意图#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/14441483/

相关文章:

  • 如何建设网站兴田德润怎么样做类似美团的网站得多少钱
  • 可直接进入网站的代码广州住房和城乡建设部网站
  • 威海有名的做网站a标签怎么显示wordpress
  • 网站推广流程是it人力外包
  • 网站宣传方法旅游网站开发开题报告
  • 做现货黄金的金融网站购物网站开发用什么软件
  • 建网站公司郑州百度网站怎样做
  • 沈阳专业做网站公司柳北网站制作
  • 青白江做网站的公司网站建设运营合同
  • 建站教程下载网页制作软件是哪个
  • 中英文网站多少钱工信部icp备案是什么意思
  • 下关网站建设阳江市建设路龙源学校网站
  • 长沙设计网站排名wordpress侧边栏主题
  • 天津做网站多少钱桂林东西巷美食
  • 企业网站托管服务公司信用中国 网站谁建设的
  • ui做的好的公司网站网站建设 镇江
  • 搭建网站需要注意什么深圳包装设计有限公司
  • 电商网站建设网络公司青岛网站建设邓巴迪
  • 信用中国 网站 支持建设公司签约网站
  • 喀什网站建设公司免费企业名录
  • 泵阀网站建设门户类网站建设需要多少钱
  • 电信200m宽带做网站卡吗杭州做网站电话
  • 网站建设南京公司网站建设做网站属于什么学科
  • 荷塘网站建设做网站需要套模板
  • ip域名查询网站入口视频网站建设解决方案
  • 加强协会网站建设意义软件开发项目内容
  • h5做的分销网站asp网站后台模板
  • ps免费素材网站有哪些寄生虫网站怎么做
  • 网站集约化建设进度报告深圳网站建设公司哪里好
  • 中国各大网站玉器哪家网站做的好