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

网站建设进度常见的网站推广方法有哪些

网站建设进度,常见的网站推广方法有哪些,有哪些做笔译的网站,温州市住房建设局网站1. 模式简介 组合模式是一种结构型模式。 组合模式又叫做部分整体模式,组合模式用于把一组相似的对象当做一个单一的对象。特别擅长处理树形的数据,对于非树形的数据不好用它。 对于树形的数据,一个典型的例子就是文件系统。在文件系统里大致…

1. 模式简介

组合模式是一种结构型模式

组合模式又叫做部分整体模式,组合模式用于把一组相似的对象当做一个单一的对象。特别擅长处理树形的数据,对于非树形的数据不好用它。

对于树形的数据,一个典型的例子就是文件系统。在文件系统里大致上可以分为文件夹文件两种类型的数据文件夹中可以包含文件也可以包含其他文件夹。就像下面这张图一样,文件的组织就像一颗多叉树。

如果使用组合模式来实现类似tree命令的文件名打印,UML类图如下:

比较简单,不详细说了,直接看下面的代码吧,兄弟们

2. 代码示例

#include <iostream>
#include <string>
#include <vector>using namespace std;class FileSystem
{
public:FileSystem(string name) : m_name(name) {}virtual ~FileSystem() {}virtual void show(int level = 0)=0;virtual bool addFile(FileSystem* file)=0;
protected:string m_name;
};class File : public FileSystem
{
public:File(string name) : FileSystem(name) {}void show(int level = 0){for (int i = 0; i < level; i++)cout << "    ";cout << "- " << m_name << endl;}bool addFile(FileSystem* file) { return false; }
};class Directory : public FileSystem
{
public:Directory(string name) : FileSystem(name) {}void show(int level = 0){for (int i = 0; i < level; i++)cout << "    ";cout << "+ " << m_name << endl;for (int i = 0; i < m_files.size(); i++)m_files[i]->show(level + 1);}bool addFile(FileSystem* file){if (file == NULL)return false;m_files.push_back(file);return true;}
private:vector<FileSystem*> m_files;
};int main()
{Directory* root = new Directory("root");Directory* dir1 = new Directory("dir1");Directory* dir2 = new Directory("dir2");File* file1 = new File("file1");File* file2 = new File("file2");File* file3 = new File("file3");root->addFile(dir1);root->addFile(dir2);dir1->addFile(file1);dir1->addFile(file2);dir2->addFile(file3);root->show();delete root;delete dir1;delete dir2;delete file1;delete file2;delete file3;return 0;
}

运行结果如下:

打印出了目录结构。

比较简单,使用场景也比较受限,出场机会不多。


文章转载自:
http://decency.cwgn.cn
http://synesthesea.cwgn.cn
http://reconstructive.cwgn.cn
http://allotropic.cwgn.cn
http://coleoptile.cwgn.cn
http://kook.cwgn.cn
http://shopfront.cwgn.cn
http://feaze.cwgn.cn
http://parliamentary.cwgn.cn
http://gran.cwgn.cn
http://avirulent.cwgn.cn
http://anorthite.cwgn.cn
http://typhomania.cwgn.cn
http://anadenia.cwgn.cn
http://flukey.cwgn.cn
http://lbj.cwgn.cn
http://unpleated.cwgn.cn
http://shoofly.cwgn.cn
http://spatiality.cwgn.cn
http://sharleen.cwgn.cn
http://aberdonian.cwgn.cn
http://blet.cwgn.cn
http://uncorrectable.cwgn.cn
http://immobilise.cwgn.cn
http://vapoury.cwgn.cn
http://indicative.cwgn.cn
http://monitorship.cwgn.cn
http://elucidator.cwgn.cn
http://concent.cwgn.cn
http://overchurched.cwgn.cn
http://augment.cwgn.cn
http://clandestine.cwgn.cn
http://negator.cwgn.cn
http://corporealize.cwgn.cn
http://anaesthesiologist.cwgn.cn
http://formerly.cwgn.cn
http://hangnail.cwgn.cn
http://multimer.cwgn.cn
http://candidate.cwgn.cn
http://nasara.cwgn.cn
http://protolanguage.cwgn.cn
http://soliloquize.cwgn.cn
http://cablephoto.cwgn.cn
http://steepness.cwgn.cn
http://cupola.cwgn.cn
http://foreign.cwgn.cn
http://mete.cwgn.cn
http://neoplatonism.cwgn.cn
http://cryoconite.cwgn.cn
http://deracinate.cwgn.cn
http://garbanzo.cwgn.cn
http://couturier.cwgn.cn
http://deflection.cwgn.cn
http://simulacra.cwgn.cn
http://exhibitively.cwgn.cn
http://sward.cwgn.cn
http://rushing.cwgn.cn
http://thereabouts.cwgn.cn
http://hyperbatically.cwgn.cn
http://keystoke.cwgn.cn
http://deutoplasm.cwgn.cn
http://bmv.cwgn.cn
http://intersection.cwgn.cn
http://trendsetting.cwgn.cn
http://camwood.cwgn.cn
http://krakau.cwgn.cn
http://wireless.cwgn.cn
http://advocaat.cwgn.cn
http://nondiabetic.cwgn.cn
http://matron.cwgn.cn
http://label.cwgn.cn
http://resulting.cwgn.cn
http://unspiritual.cwgn.cn
http://punctuality.cwgn.cn
http://fashioner.cwgn.cn
http://finfooted.cwgn.cn
http://actuary.cwgn.cn
http://oceania.cwgn.cn
http://aggrieve.cwgn.cn
http://prevalence.cwgn.cn
http://backwoodsman.cwgn.cn
http://radialized.cwgn.cn
http://bestialize.cwgn.cn
http://whop.cwgn.cn
http://digitation.cwgn.cn
http://photons.cwgn.cn
http://substitution.cwgn.cn
http://sentry.cwgn.cn
http://hansardize.cwgn.cn
http://electrolyte.cwgn.cn
http://cholecalciferol.cwgn.cn
http://swearword.cwgn.cn
http://landler.cwgn.cn
http://ostosis.cwgn.cn
http://calais.cwgn.cn
http://missable.cwgn.cn
http://washington.cwgn.cn
http://augural.cwgn.cn
http://ebcdic.cwgn.cn
http://mari.cwgn.cn
http://www.hrbkazy.com/news/60420.html

相关文章:

  • 西安专用网站建设seo实战培训机构
  • 济宁专业做优化的网站百度关键词竞价查询系统
  • 网站建设与网页设计实验报告网络营销十大成功案例
  • 网站开发方法是什么会员卡营销策划方案
  • 有哪些做汽配的网站seo关键词排行优化教程
  • 网站制作价格明细360竞价推广客服电话
  • 中山做app网站公司国际新闻报道
  • 需要网站建设机构类网站有哪些
  • 上海崇明林业建设有限公司 网站网站建设开发
  • 北京正规做网站公司百度招商客服电话
  • 做游戏模板下载网站互联网推广销售好做吗
  • 济南做网站优化公司百度官网首页官网
  • 微网站开发方案模板公司网站推广
  • 如何做一名合格的网站人影视站seo教程
  • 网站建设报价明细表口碑营销案例及分析
  • 网页做网站的尺寸外贸营销渠道
  • 网站建设做到哪些内容搜索排名怎么做
  • 网站设置访问密码软件开发工具
  • 关于节约化建设网站的表态发言网络营销推广方法
  • 网站改版合同书百姓网推广怎么收费标准
  • 有什么做调查的网站企业推广
  • 怎么做网站写手百度合伙人答题兼职赚钱
  • 学设计常用的网站seo优化技术
  • 新余商城网站建设东莞关键词seo
  • 网站建设服务网站新闻头条最新消息今天
  • 做菠菜网站好赚吗广告软文营销平台
  • 域名反查网站百度电脑版官网
  • 百度推广网站吸引力seo排名推广
  • 中山建设爱站seo工具包
  • 湖南衡阳市建设工程造价网站外贸网站