DesignPattern/11.FacadePattern/2.Code/FacadePattern.h

69 lines
872 B
C
Raw Normal View History

2019-10-26 07:43:05 +00:00
#ifndef __FACADE_PATTERN_H__
#define __FACADE_PATTERN_H__
//<2F><>ϵͳ<CFB5><CDB3><EFBFBD>ڴ<EFBFBD>
class Memory
{
public:
Memory(){}
void selfCheck(){
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>Լ졭<EFBFBD><EFBFBD>\n");
}
};
//<2F><>ϵͳ<CFB5><CDB3>CPU
class CPU
{
public:
CPU(){}
void run(){
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CPU<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD>\n");
}
};
//<2F><>ϵͳ<CFB5><CDB3>Ӳ<EFBFBD><D3B2>
class HardDisk
{
public:
HardDisk(){}
void read(){
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡӲ<EFBFBD>̡<EFBFBD><EFBFBD><EFBFBD>\n");
}
};
//<2F><>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ
class OS
{
public:
OS(){}
void load(){
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
}
};
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
class Facade
{
public:
Facade(){
memory = new Memory();
cpu = new CPU();
hardDisk = new HardDisk();
os = new OS();
}
void powerOn(){
printf("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
memory->selfCheck();
cpu->run();
hardDisk->read();
os->load();
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>\n");
}
private:
Memory *memory;
CPU *cpu;
HardDisk *hardDisk;
OS *os;
};
#endif //__FACADE_PATTERN_H__