Facade_Pattern - 8BitsCoding/RobotMentor GitHub Wiki
์ ์
ํต์ผ๋ ์ธํฐํ์ด์ค๋ฅผ ํตํด ๋ณต์กํ ์๋ธ์์คํ ๋ค์ ๊ฐ๋จํ ์ฌ์ฉํ๋๋ก ๋ง๋ ํจํด
๋งค์ฐ ๊ฐ๋จ
์์๋ก ์ค๋ช
class BIOS
{
public:
void operation() { cout << "\t-BIOS Loading..." << endl; }
};
class CPU
{
public:
void operation() { cout << "\t-CPU Processing..." << endl; }
};
class MEMORY
{
public:
void operation() { cout << "\t-Memory Loading..." << endl; }
};
class HDD
{
public:
void operation() { cout << "\t-Hard Disk Loading..." << endl; }
};
class Computer
{
public:
Computer(BIOS *a, CPU *b, MEMORY* c, HDD* d) : mBios(a), mCpu(b), mMemory(c), mHdd(d) {}
public:
void Booting()
{
cout << "+Computer Booting Start" << endl;
mBios->operation();
mCpu->operation();
mMemory->operation();
mHdd->operation();
cout << "+Computer Booting Complete" << endl;
}
private:
BIOS* mBios;
CPU* mCpu;
MEMORY* mMemory;
HDD* mHdd;
};
//------------------------------------------------------------------
// Main
int _tmain(int argc, _TCHAR* argv[])
{
BIOS bios;
CPU cpu;
MEMORY memory;
HDD hdd;
Computer mComputer(&bios, &cpu, &memory, &hdd);
mComputer.Booting();
getchar();
return 0;
}