DesignPattern/20.ObserverPattern/2.Code/main.cpp

39 lines
758 B
C++
Raw Normal View History

2019-11-06 13:36:28 +00:00
#include "Observer.h"
#include "AllyCenter.h"
int main()
{
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ս<EFBFBD><D5BD>
AllyCenterController* controller = new AllyCenterController();
// <20><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD>ң<EFBFBD><D2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD>
Player* Jungle = new Player("Jungle");
Player* Single = new Player("Single");
Player* Jianmengtu = new Player("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
Player* SillyDog = new Player("ɵ<EFBFBD>ӹ<EFBFBD>");
controller->join(Jungle);
controller->join(Single);
controller->join(Jianmengtu);
controller->join(SillyDog);
printf("\n\n");
// Jungle<6C><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD>
Jungle->call(RESOURCE, controller);
printf("\n\n");
// ɵ<>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD>ȶ<EFBFBD><C8B6><EFBFBD>
SillyDog->call(HELP, controller);
printf("\n\n");
system("pause");
2020-11-29 03:17:40 +00:00
delete controller;
delete Jungle;
delete Single;
delete Jianmengtu;
delete SillyDog;
2019-11-06 13:36:28 +00:00
return 0;
}