⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bridge.h

📁 设计模式C++源码(other)Bridge.rar
💻 H
字号:
/** * bridge.h * Implemented by Blueprint Technologies, Inc. */#ifndef _bridge_h#define _bridge_h/** * Defines the interface for implementation classes. This * interface doesn't have to correspond exactly to Abstraction's * interface; in fact the two interfaces can be quite different. * Typically the Implementor interface provides only primitive * operations, and Abstraction defines higher-level operations * based on these primitives. */class Implementor{public:	virtual void operationImp() = 0;};/** * Implements the Implementor interface and defines its * concrete implementation. */class ConcreteImplementorA: public Implementor{public:	virtual void operationImp()	{		// Do something.	};};/** * Implements the Implementor interface and defines its * concrete implementation. */class ConcreteImplementorB: public Implementor{public:	virtual void operationImp()	{		// Do something.	};};/** * Defines the abstraction's interface. Maintains a reference * to an object of type Implementor. */class Abstraction{private:	Implementor* implementor;public:	Abstraction(): implementor(0)	{	};	virtual void operation()	{		implementor -> operationImp();	};	void setImplementor( Implementor* implementor )	{		this -> implementor = implementor;	};	Implementor* getImplementor()	{		return implementor;	};};/** * Extends the interface defined by Abstraction. */class RefinedAbstraction: public Abstraction{public:	virtual void operation()	{		Abstraction::operation();				/**		 * new behavior here.		 */	};};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -