fix some code bug

master
FengJungle 2021-10-29 21:33:26 +08:00
parent d4d7abc3ec
commit 0ecf749949
5 changed files with 12 additions and 6 deletions

View File

@ -22,7 +22,7 @@ class GameA:public Game
public:
GameA(){}
void play(){
printf("Jungle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϷA\n");
printf("Jungle玩游戏A\n");
}
};
@ -32,7 +32,7 @@ class GameB :public Game
public:
GameB(){}
void play(){
printf("Jungle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϷB\n");
printf("Jungle玩游戏B\n");
}
};

View File

@ -16,7 +16,7 @@ class Phone :public Component
public:
Phone(){}
void operation(){
printf("<EFBFBD>ֻ<EFBFBD>\n");
printf("手机\n");
}
};

View File

@ -47,6 +47,8 @@ public:
realSubject = new RealSubject();
log = new Log();
}
Proxy(const Proxy& o) = delete;
Proxy& operator=(const Proxy&) = delete;
~Proxy(){
delete realSubject;
delete log;

View File

@ -72,6 +72,8 @@ public:
printf("开关控制电灯\n");
lamp = new Lamp();
}
LampCommand(const LampCommand&) = delete;
LampCommand& operator=(const LampCommand&) = delete;
~LampCommand(){
delete lamp;
lamp = nullptr;
@ -97,9 +99,11 @@ public:
printf("开关控制风扇\n");
fan = new Fan();
}
FanCommand(const FanCommand& a) = delete;
FanCommand& operator=(const FanCommand&) = delete;
~FanCommand(){
delete lamp;
lamp = nullptr;
delete fan;
fan = nullptr;
}
// 实现execute()
void execute(){

View File

@ -21,7 +21,7 @@ int main()
printf("\n\n");
// 逆序遍历
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
printf("逆序遍历:\n");
remoteControl->last();
// 遍历电视所有频道
while (remoteControl->hasPrevious()){