bugfix: change character code : utf-8

master
FengJungle 2021-10-28 21:58:09 +08:00
parent 49bc9c8130
commit 4d8d1ca606
4 changed files with 34 additions and 34 deletions

View File

@ -6,7 +6,7 @@
#include <mutex>
using namespace std;
//实现类接口
// 实现类接口Implementor
class Game
{
public:
@ -16,47 +16,47 @@ public:
private:
};
//具体实现类GameA
// 具体实现类GameA
class GameA:public Game
{
public:
GameA(){}
void play(){
printf("Jungle玩游戏A\n");
printf("Jungle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϷA\n");
}
};
//具体实现类GameB
// 具体实现类GameB
class GameB :public Game
{
public:
GameB(){}
void play(){
printf("Jungle玩游戏B\n");
printf("Jungle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϷB\n");
}
};
//抽象类Phone
//抽象类Phone
class Phone
{
public:
Phone(){
}
virtual ~Phone(){}
//安装游戏
// Setup game
virtual void setupGame(Game *igame) = 0;
virtual void play() = 0;
private:
Game *game;
};
//扩充抽象类PhoneA
// 扩充抽象类PhoneA
class PhoneA:public Phone
{
public:
PhoneA(){
}
//安装游戏
// Setup game
void setupGame(Game *igame){
this->game = igame;
}
@ -67,13 +67,13 @@ private:
Game *game;
};
//扩充抽象类PhoneB
// 扩充抽象类PhoneB
class PhoneB :public Phone
{
public:
PhoneB(){
}
//安装游戏
// Setup game
void setupGame(Game *igame){
this->game = igame;
}

View File

@ -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);

View File

@ -6,7 +6,7 @@
#include <vector>
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;
//构件列表
// 构件列表
vector<Component*>componentList;
};

View File

@ -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);