mirror of
https://github.com/huihut/interview.git
synced 2026-03-13 10:02:55 +08:00
添加设计模式及例子,包括:单例、抽象工厂、适配器、桥接、观察者模式
This commit is contained in:
23
DesignPattern/BridgePattern/abstraction.h
Normal file
23
DesignPattern/BridgePattern/abstraction.h
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Created by xiemenghui on 2018/7/21.
|
||||
//
|
||||
|
||||
#ifndef DESIGNPATTERN_ABSTRACTION_H
|
||||
#define DESIGNPATTERN_ABSTRACTION_H
|
||||
|
||||
#include "implementor.h"
|
||||
|
||||
// 开关
|
||||
class ISwitch
|
||||
{
|
||||
public:
|
||||
ISwitch(IElectricalEquipment *ee){ m_pEe = ee; }
|
||||
virtual ~ISwitch(){}
|
||||
virtual void On() = 0; // 打开电器
|
||||
virtual void Off() = 0; // 关闭电器
|
||||
|
||||
protected:
|
||||
IElectricalEquipment * m_pEe;
|
||||
};
|
||||
|
||||
#endif //DESIGNPATTERN_ABSTRACTION_H
|
||||
Reference in New Issue
Block a user