/*****************************************
Copyright (c) 2016 Jingshuang Hu
@filename:System.h
@datetime:2016.09.15
@author:HJS
@e-mail:[email protected]
@blog:http://blog.csdn.net/hujingshuang
*****************************************/
#ifndef _SYSTEM_H
#define _SYSTEM_H
class subSystemA {
public:
void fun();
};
class subSystemB {
public:
void fun();
};
class subSystemC {
public:
void fun();
};
class subSystemD {
public:
void fun();
};
#endif // _SYSTEM_H
/*****************************************
Copyright (c) 2016 Jingshuang Hu
@filename:System.cpp
@datetime:2016.09.15
@author:HJS
@e-mail:[email protected]
@blog:http://blog.csdn.net/hujingshuang
*****************************************/
#include "System.h"
#include <iostream>
using namespace std;
void subSystemA::fun() {
cout << "system A" << endl;
}
void subSystemB::fun() {
cout << "system B" << endl;
}
void subSystemC::fun() {
cout << "system C" << endl;
}
void subSystemD::fun() {
cout << "system D" << endl;
}
/*****************************************
Copyright (c) 2016 Jingshuang Hu
@filename:Facade.h
@datetime:2016.09.15
@author:HJS
@e-mail:[email protected]
@blog:http://blog.csdn.net/hujingshuang
*****************************************/
#ifndef _FACADE_H
#define _FACADE_H
class Facade {
public:
void fun();
};
#endif // _FACADE_H
/*****************************************
Copyright (c) 2016 Jingshuang Hu
@filename:Facade.cpp
@datetime:2016.09.15
@author:HJS
@e-mail:[email protected]
@blog:http://blog.csdn.net/hujingshuang
*****************************************/
#include "Facade.h"
#include "System.h"
class System;
void Facade::fun() {
subSystemA *system1 = new subSystemA();
subSystemB *system2 = new subSystemB();
subSystemC *system3 = new subSystemC();
subSystemD *system4 = new subSystemD();
system1->fun();
system2->fun();
system3->fun();
system4->fun();
}
/*****************************************
Copyright (c) 2016 Jingshuang Hu
@filename:main.cpp
@datetime:2016.09.15
@author:HJS
@e-mail:[email protected]
@blog:http://blog.csdn.net/hujingshuang
*****************************************/
#include <iostream>
#include "Facade.h"
#include "System.h"
using namespace std;
int main() {
Facade* facade = new Facade();
facade->fun();
system("pause");
return 0;
}