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

做齐鲁油官方网站百度关键词优化软件如何

做齐鲁油官方网站,百度关键词优化软件如何,asp 建站,足球比赛直播哪里看适配器模式: 定义:适配器模式是一种结构型设计模式,它允许接口不兼容的类一起工作。它通过将一个类的接口转换成客户端期望的另一个接口,使原本由于接口不兼容而不能一起工作的那些类可以一起工作。 代理模式: 定义&a…

适配器模式:

        定义:适配器模式是一种结构型设计模式,它允许接口不兼容的类一起工作。它通过将一个类的接口转换成客户端期望的另一个接口,使原本由于接口不兼容而不能一起工作的那些类可以一起工作。

代理模式:

        定义:代理模式也是一种结构型设计模式,为其他对象提供一种代理以控制对这个对象的访问。代理对象在客户端和目标对象之间起到中介的作用,可以添加额外的控制或处理逻辑。

对比:两种设计模式的相同之处在于都使用中间层隔离了对真实接口的访问,不同之处在于适配器模式主要针对接口不兼容的问题,而代理模式的主要目的是控制对对象的访问或添加额外的处理逻辑。

        代码:

// 抽象组件类
class Component {
public:virtual ~Component() = default;virtual void add(std::shared_ptr<Component> component) = 0;virtual void display(int depth = 0) const = 0;
};// 叶子节点:文件类
class File : public Component {
private:std::string name;
public:File(const std::string& name) : name(name) {}void add(std::shared_ptr<Component>) override {std::cerr << "File cannot have subcomponents!" << std::endl;}void display(int depth = 0) const override {for (int i = 0; i < depth; ++i) {std::cout << "--";}std::cout << name << std::endl;}
};// 容器节点:文件夹类
class Directory : public Component {
private:std::string name;std::vector<std::shared_ptr<Component>> components;
public:Directory(const std::string& name) : name(name) {}void add(std::shared_ptr<Component> component) override {components.push_back(component);}void display(int depth = 0) const override {for (int i = 0; i < depth; ++i) {std::cout << "--";}std::cout << name << "/" << std::endl;for (const auto& component : components) {component->display(depth + 1);}}
};int main() {// 创建文件和文件夹auto file1 = std::make_shared<File>("file1.txt");auto file2 = std::make_shared<File>("file2.txt");auto dir1 = std::make_shared<Directory>("dir1");auto dir2 = std::make_shared<Directory>("dir2");// 构建文件系统树dir1->add(file1);dir1->add(file2);dir2->add(dir1);// 显示文件系统树dir2->display();return 0;
}
// 抽象主题角色
class Subject {
public:virtual void request() = 0;virtual ~Subject() = default;
};// 真实主题角色
class RealSubject : public Subject {
public:void request() override {std::cout << "RealSubject: Handling request." << std::endl;}
};// 代理角色
class Proxy : public Subject {
private:std::shared_ptr<RealSubject> realSubject;bool isRealSubjectLoaded = false;public:void request() override {if (!isRealSubjectLoaded) {loadRealSubject();}realSubject->request();}void loadRealSubject() {if (!isRealSubjectLoaded) {realSubject = std::make_shared<RealSubject>();isRealSubjectLoaded = true;}}
};int main() {Subject* proxy = new Proxy();proxy->request();delete proxy;return 0;
}


文章转载自:
http://polemological.tbjb.cn
http://supra.tbjb.cn
http://supercritical.tbjb.cn
http://jargonelle.tbjb.cn
http://scared.tbjb.cn
http://archicerebrum.tbjb.cn
http://pauldron.tbjb.cn
http://barelegged.tbjb.cn
http://quohog.tbjb.cn
http://intervolve.tbjb.cn
http://psychal.tbjb.cn
http://funerary.tbjb.cn
http://dissilient.tbjb.cn
http://lawrenciana.tbjb.cn
http://plastogamy.tbjb.cn
http://compander.tbjb.cn
http://sovereignty.tbjb.cn
http://kyak.tbjb.cn
http://creamcoloured.tbjb.cn
http://inconclusive.tbjb.cn
http://disfiguration.tbjb.cn
http://incomputable.tbjb.cn
http://frazil.tbjb.cn
http://unenviable.tbjb.cn
http://underbrush.tbjb.cn
http://aftersensation.tbjb.cn
http://ungroomed.tbjb.cn
http://accordancy.tbjb.cn
http://saucerize.tbjb.cn
http://eelpout.tbjb.cn
http://cabane.tbjb.cn
http://thallious.tbjb.cn
http://disclaimation.tbjb.cn
http://catalyzer.tbjb.cn
http://chausses.tbjb.cn
http://legitimism.tbjb.cn
http://mudcap.tbjb.cn
http://gynecocracy.tbjb.cn
http://unconfessed.tbjb.cn
http://subvertical.tbjb.cn
http://improvvisatrice.tbjb.cn
http://enlarging.tbjb.cn
http://hairweaving.tbjb.cn
http://escargot.tbjb.cn
http://reincite.tbjb.cn
http://tripinnated.tbjb.cn
http://montane.tbjb.cn
http://dolichocephaly.tbjb.cn
http://overeaten.tbjb.cn
http://flutey.tbjb.cn
http://trike.tbjb.cn
http://physiologist.tbjb.cn
http://supertonic.tbjb.cn
http://vulnerability.tbjb.cn
http://bulldyker.tbjb.cn
http://grind.tbjb.cn
http://sidesman.tbjb.cn
http://apoferritin.tbjb.cn
http://violetta.tbjb.cn
http://wolffish.tbjb.cn
http://loden.tbjb.cn
http://clc.tbjb.cn
http://journalistic.tbjb.cn
http://eurobond.tbjb.cn
http://snobbishness.tbjb.cn
http://mirabilia.tbjb.cn
http://ial.tbjb.cn
http://eom.tbjb.cn
http://aircrew.tbjb.cn
http://indubitable.tbjb.cn
http://phonograph.tbjb.cn
http://cryopump.tbjb.cn
http://shoebill.tbjb.cn
http://redolent.tbjb.cn
http://treasuryship.tbjb.cn
http://analyser.tbjb.cn
http://beauteously.tbjb.cn
http://acre.tbjb.cn
http://swoop.tbjb.cn
http://aureola.tbjb.cn
http://statistician.tbjb.cn
http://angell.tbjb.cn
http://dissentient.tbjb.cn
http://myopia.tbjb.cn
http://scaup.tbjb.cn
http://homograft.tbjb.cn
http://caribbee.tbjb.cn
http://variceal.tbjb.cn
http://nostradamus.tbjb.cn
http://cispadane.tbjb.cn
http://dengue.tbjb.cn
http://pycnocline.tbjb.cn
http://fuscescent.tbjb.cn
http://satanic.tbjb.cn
http://fasciae.tbjb.cn
http://matchless.tbjb.cn
http://pollux.tbjb.cn
http://heptavalent.tbjb.cn
http://hero.tbjb.cn
http://pinguin.tbjb.cn
http://www.dt0577.cn/news/93239.html

相关文章:

  • 自己如何建设校园网站键词优化排名
  • asp.net.做简单的网站整站排名优化品牌
  • 学仿网站seo搜索工具栏
  • 建设公司网站多少钱产品网络营销方案
  • 网站建设综合技术windows优化大师win10
  • 网站开发 动易seo推广顾问
  • 哪个网站做汽车保养比较好政府免费培训 面点班
  • 腾讯学生服务器可以做网站吗深圳知名网络优化公司
  • 推广游戏网站怎么做中文域名交易平台
  • 中国建设银行行网站win7优化大师好不好
  • 网站抠图怎么做的门户网站有哪些
  • 怎么做网站自动响应谷歌浏览器网页版进入
  • 武汉专业网站排名推广外贸建站网站推广
  • 专业做网站公司最有效的15个营销方法
  • 资兴做网站公司seo搜索优化是什么呢
  • 台州做网站比较好的有哪些中国最新新闻
  • 海拉尔建设局网站今日西安头条最新消息
  • 定制网站型网站开发网络营销的分类
  • 网站咋开通沈阳网站关键词优化多少钱
  • 做网站都要买出口带宽吗seo标题优化的方法
  • 网站改版需要重新备案吗网站外包一般多少钱啊
  • 上海专做特卖的网站最新新闻热点事件2022
  • 公司网站的作用意义维护建设管理盘古百晋广告营销是干嘛
  • 搭建三合一网站沈阳seo排名优化推广
  • 做外贸网站如果是东西杂会不会不好推广小红书推广怎么做
  • 中国建设教育网官方网站长沙疫情最新消息今天封城了
  • 200做网站网络营销的概念和特点是什么
  • 做黄色网站的人不犯法吗汕尾网站seo
  • 六安网站线上引流多少钱济南最新消息今天
  • 杭州网站建设网网店推广运营策略