DesignPattern/08.BridgePattern/2.Code/main.cpp

27 lines
458 B
C++
Raw Normal View History

2019-10-23 14:19:36 +00:00
#include <iostream>
#include "BridgePattern.h"
int main()
{
Game *game;
Phone *phone;
2021-10-28 13:58:09 +00:00
// Jungle买了PhoneA品牌的手机想玩游戏A
2019-10-23 14:19:36 +00:00
phone = new PhoneA();
game = new GameA();
phone->setupGame(game);
phone->play();
printf("++++++++++++++++++++++++++++++++++\n");
2021-10-28 13:58:09 +00:00
// Jungle想在这个手机上玩游戏B
2020-11-29 05:40:29 +00:00
delete game;
2019-10-23 14:19:36 +00:00
game = new GameB();
phone->setupGame(game);
phone->play();
2020-11-29 05:40:29 +00:00
delete phone;
delete game;
2019-10-23 14:19:36 +00:00
system("pause");
return 0;
}