-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbridge.h
More file actions
43 lines (38 loc) · 882 Bytes
/
bridge.h
File metadata and controls
43 lines (38 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef BRIDGE_H
#define BRIDGE_H
class Implementor;
// 维护一个Implementor类的指针
class Abstraction
{
public:
Abstraction(Implementor *pImplementor);
virtual ~Abstraction();
void Operation();
protected:
Implementor *m_pImplementor;
};
// 为实现Abstraction定义的抽象基类,定义了实现的接口函数
class Implementor
{
public:
Implementor(){}
virtual ~Implementor(){}
virtual void OperationImpl() = 0;
};
// 继承自Implementor,是Implementor的不同实现之一
class ConcreteImplementorA : public Implementor
{
public:
ConcreteImplementorA(){}
virtual ~ConcreteImplementorA(){}
virtual void OperationImpl();
};
// 继承自Implementor,是Implementor的不同实现之一
class ConcreteImplementorB : public Implementor
{
public:
ConcreteImplementorB(){}
virtual ~ConcreteImplementorB(){}
virtual void OperationImpl();
};
#endif//BRIDGE_H