From 4d8d1ca606658aea6c3b80dcf744a428d55c8c80 Mon Sep 17 00:00:00 2001 From: FengJungle Date: Thu, 28 Oct 2021 21:58:09 +0800 Subject: [PATCH] bugfix: change character code : utf-8 --- 08.BridgePattern/2.Code/BridgePattern.h | 22 ++++++++--------- 08.BridgePattern/2.Code/main.cpp | 4 ++-- 09.CompositePattern/2.Code/CompositePattern.h | 18 +++++++------- 09.CompositePattern/2.Code/main.cpp | 24 +++++++++---------- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/08.BridgePattern/2.Code/BridgePattern.h b/08.BridgePattern/2.Code/BridgePattern.h index 41787be..37e3c2f 100644 --- a/08.BridgePattern/2.Code/BridgePattern.h +++ b/08.BridgePattern/2.Code/BridgePattern.h @@ -6,7 +6,7 @@ #include using namespace std; -//实现类接口 +// 瀹炵幇绫绘帴鍙mplementor class Game { public: @@ -16,47 +16,47 @@ public: private: }; -//具体实现类GameA +// 鍏蜂綋瀹炵幇绫籊ameA class GameA:public Game { public: GameA(){} void play(){ - printf("Jungle玩游戏A\n"); + printf("Jungle锟斤拷锟斤拷戏A\n"); } }; -//具体实现类GameB +// 鍏蜂綋瀹炵幇绫籊ameB class GameB :public Game { public: GameB(){} void play(){ - printf("Jungle玩游戏B\n"); + printf("Jungle锟斤拷锟斤拷戏B\n"); } }; -//抽象类Phone +//鎶借薄绫籔hone class Phone { public: Phone(){ } virtual ~Phone(){} - //安装游戏 + // Setup game virtual void setupGame(Game *igame) = 0; virtual void play() = 0; private: Game *game; }; -//扩充抽象类PhoneA +// 鎵╁厖鎶借薄绫籔honeA class PhoneA:public Phone { public: PhoneA(){ } - //安装游戏 + // Setup game void setupGame(Game *igame){ this->game = igame; } @@ -67,13 +67,13 @@ private: Game *game; }; -//扩充抽象类PhoneB +// 鎵╁厖鎶借薄绫籔honeB class PhoneB :public Phone { public: PhoneB(){ } - //安装游戏 + // Setup game void setupGame(Game *igame){ this->game = igame; } diff --git a/08.BridgePattern/2.Code/main.cpp b/08.BridgePattern/2.Code/main.cpp index ac91648..05ef7f2 100644 --- a/08.BridgePattern/2.Code/main.cpp +++ b/08.BridgePattern/2.Code/main.cpp @@ -6,14 +6,14 @@ int main() Game *game; Phone *phone; - //Jungle买了PhoneA品牌的手机,想玩游戏A + // Jungle涔颁簡PhoneA鍝佺墝鐨勬墜鏈猴紝鎯崇帺娓告垙A phone = new PhoneA(); game = new GameA(); phone->setupGame(game); phone->play(); printf("++++++++++++++++++++++++++++++++++\n"); - //Jungle想在这个手机上玩游戏B + // Jungle鎯冲湪杩欎釜鎵嬫満涓婄帺娓告垙B delete game; game = new GameB(); phone->setupGame(game); diff --git a/09.CompositePattern/2.Code/CompositePattern.h b/09.CompositePattern/2.Code/CompositePattern.h index d3ce818..c40a91b 100644 --- a/09.CompositePattern/2.Code/CompositePattern.h +++ b/09.CompositePattern/2.Code/CompositePattern.h @@ -6,7 +6,7 @@ #include using namespace std; -//抽象构件 +// 鎶借薄鏋勪欢 class Component { public: @@ -15,13 +15,13 @@ public: this->name = iName; } virtual ~Component(){} - //增加一个部门或办公室 + // 澧炲姞涓涓儴闂ㄦ垨鍔炲叕瀹 virtual void add(Component*) = 0; - //撤销一个部门或办公室 + // 鎾ら攢涓涓儴闂ㄦ垨鍔炲叕瀹 virtual void remove(Component*) = 0; // virtual Component* getChild(int) = 0; - //各部门操作 + // 鍚勯儴闂ㄦ搷浣 virtual void operation() = 0; string getName(){ return name; @@ -30,7 +30,7 @@ private: string name; }; -//叶子构件:办公室 +// 鍙跺瓙鏋勪欢锛氬姙鍏 class Office :public Component { public: @@ -52,7 +52,7 @@ private: string name; }; -//叶子构件:行政办公室 +// 鍙跺瓙鏋勪欢锛氳鏀垮姙鍏 class AdminOffice :public Office { public: @@ -66,7 +66,7 @@ private: string name; }; -//叶子构件:教务办公室 +// 鍙跺瓙鏋勪欢锛氭暀鍔″姙鍏 class DeanOffice :public Office { public: @@ -80,7 +80,7 @@ private: string name; }; -//容器构件SubComponent +// 瀹瑰櫒鏋勪欢SubComponent class SubComponent :public Component { public: @@ -110,7 +110,7 @@ public: private: string name; - //构件列表 + // 鏋勪欢鍒楄〃 vectorcomponentList; }; diff --git a/09.CompositePattern/2.Code/main.cpp b/09.CompositePattern/2.Code/main.cpp index d528555..e6a5b5e 100644 --- a/09.CompositePattern/2.Code/main.cpp +++ b/09.CompositePattern/2.Code/main.cpp @@ -6,23 +6,23 @@ int main() Component *head, *sichuanBranch, *cdBranch, *myBranch, *office1, *office2, *office3, *office4, *office5, *office6, *office7, *office8; - head = new SubComponent("总部"); - sichuanBranch = new SubComponent("四川分部"); - office1 = new AdminOffice("行政办公室"); - office2 = new DeanOffice("教务办公室"); + head = new SubComponent("鎬婚儴"); + sichuanBranch = new SubComponent("鍥涘窛鍒嗛儴"); + office1 = new AdminOffice("琛屾斂鍔炲叕瀹"); + office2 = new DeanOffice("鏁欏姟鍔炲叕瀹"); - cdBranch = new SubComponent("成都分部"); - myBranch = new SubComponent("绵阳分部"); - office3 = new AdminOffice("行政办公室"); - office4 = new DeanOffice("教务办公室"); + cdBranch = new SubComponent("鎴愰兘鍒嗛儴"); + myBranch = new SubComponent("缁甸槼鍒嗛儴"); + office3 = new AdminOffice("琛屾斂鍔炲叕瀹"); + office4 = new DeanOffice("鏁欏姟鍔炲叕瀹"); - office5 = new AdminOffice("行政办公室"); - office6 = new DeanOffice("教务办公室"); + office5 = new AdminOffice("琛屾斂鍔炲叕瀹"); + office6 = new DeanOffice("鏁欏姟鍔炲叕瀹"); - office7 = new AdminOffice("行政办公室"); - office8 = new DeanOffice("教务办公室"); + office7 = new AdminOffice("琛屾斂鍔炲叕瀹"); + office8 = new DeanOffice("鏁欏姟鍔炲叕瀹"); cdBranch->add(office5); cdBranch->add(office6);