2018-07-22 14:50:54 +08:00
|
|
|
//
|
|
|
|
// Created by xiemenghui on 2018/7/20.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include "SingletonPattern/SingletonMain.h"
|
|
|
|
#include "AbstractFactoryPattern/FactoryMain.h"
|
|
|
|
#include "AdapterPattern/AdapterMain.h"
|
|
|
|
#include "BridgePattern/BridgeMain.h"
|
|
|
|
#include "ObserverPattern/ObserverMain.h"
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
std::cout << "*******************" << std::endl;
|
2020-12-16 15:35:42 +08:00
|
|
|
std::cout << "** Design pattern example **" << std::endl;
|
2018-07-22 14:50:54 +08:00
|
|
|
std::cout << "*******************" << std::endl;
|
|
|
|
|
|
|
|
std::cout << "*******************" << std::endl;
|
2020-12-16 15:35:42 +08:00
|
|
|
std::cout << "** Singleton mode **" << std::endl;
|
2018-07-22 14:50:54 +08:00
|
|
|
std::cout << "*******************" << std::endl;
|
|
|
|
SingletonMain();
|
|
|
|
|
|
|
|
std::cout << "*******************" << std::endl;
|
2020-12-16 15:35:42 +08:00
|
|
|
std::cout << "** Abstract factory pattern **" << std::endl;
|
2018-07-22 14:50:54 +08:00
|
|
|
std::cout << "*******************" << std::endl;
|
|
|
|
FactoryMain();
|
|
|
|
|
|
|
|
std::cout << "*******************" << std::endl;
|
2020-12-16 15:35:42 +08:00
|
|
|
std::cout << "** Adapter mode **" << std::endl;
|
2018-07-22 14:50:54 +08:00
|
|
|
std::cout << "*******************" << std::endl;
|
|
|
|
AdapterMain();
|
|
|
|
|
|
|
|
std::cout << "*******************" << std::endl;
|
2020-12-16 15:35:42 +08:00
|
|
|
std::cout << "** Bridge mode **" << std::endl;
|
2018-07-22 14:50:54 +08:00
|
|
|
std::cout << "*******************" << std::endl;
|
|
|
|
|
|
|
|
std::cout << "*******************" << std::endl;
|
2020-12-16 15:35:42 +08:00
|
|
|
std::cout << "** Observer mode **" << std::endl;
|
2018-07-22 14:50:54 +08:00
|
|
|
std::cout << "*******************" << std::endl;
|
|
|
|
ObserverMain();
|
|
|
|
|
|
|
|
return 0;
|
2020-12-16 15:35:42 +08:00
|
|
|
}
|