cpp-interview/DesignPattern/BridgePattern/BridgeMain.cpp

30 lines
666 B
C++
Raw Normal View History

//
// Created by xiemenghui on 2018/7/21.
//
#include "BridgeMain.h"
void BridgeMain()
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD><C6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>
IElectricalEquipment * light = new Light();
IElectricalEquipment * fan = new Fan();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><D8A3><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ء<EFBFBD><D8A1><EFBFBD>λ<EFBFBD><CEBB><EFBFBD>أ<EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>غ͵<D8BA><CDB5>ƹ<EFBFBD><C6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD>غͷ<D8BA><CDB7>ȹ<EFBFBD><C8B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ISwitch * pullChain = new PullChainSwitch(light);
ISwitch * twoPosition = new TwoPositionSwitch(fan);
// <20><><EFBFBD>ơ<EFBFBD><C6A1>ص<EFBFBD>
pullChain->On();
pullChain->Off();
// <20>򿪷<EFBFBD><F2BFAAB7>ȡ<EFBFBD><C8A1>رշ<D8B1><D5B7><EFBFBD>
twoPosition->On();
twoPosition->Off();
SAFE_DELETE(twoPosition);
SAFE_DELETE(pullChain);
SAFE_DELETE(fan);
SAFE_DELETE(light);
}