SIGN IN SIGN UP
huihut / interview UNCLAIMED

📚 C/C++ 技术面试基础知识总结,包括语言、程序库、数据结构、算法、系统、网络、链接装载库等知识及面试经验、招聘、内推等信息。This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C/C++ technology, including language, program library, data structure, algorithm, system, network, link loading library, interview experience, recruitment, recommendation, etc.

0 0 41 C++
//
// Created by xiemenghui on 2018/7/21.
//
#include "BridgeMain.h"
void BridgeMain()
{
// Create electrical appliances (electric lights, electric fans)
IElectricalEquipment * light = new Light();
IElectricalEquipment * fan = new Fan();
// Create switch (pull chain switch, two-position switch)
// Associating a pull chain switch with a light and a two-position switch with a fan
ISwitch * pullChain = new PullChainSwitch(light);
ISwitch * twoPosition = new TwoPositionSwitch(fan);
// Lights on, lights off
pullChain->On();
pullChain->Off();
// Turn on the fan, turn off the fan
twoPosition->On();
twoPosition->Off();
SAFE_DELETE(twoPosition);
SAFE_DELETE(pullChain);
SAFE_DELETE(fan);
SAFE_DELETE(light);
}