/*********************************
*设计模式--适配器1模式实现
*C++语言
*Author:WangYong
*Blog:http://www.cnblogs.com/newwy
********************************/
#include <iostream>
using namespace std;
class Target
{
	public:
	virtual ~Target(){}
	virtual void Request(){cout<<"Target::Request"<<endl;}
};
class Adaptee
{
	public:
	Adaptee(){}
	~Adaptee(){}
	void SpecificRequest(){cout<<"Adaptee::SpecificRequest"<<endl;}
};
class Adapter:public Target, private Adaptee
{
	public:
	Adapter(){}
	~Adapter(){}
	void Request(){this->SpecificRequest();}
};
int main()
{
	Target *adt = new Adapter();
	adt->Request();
	return 0;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
猜你喜欢
  • 2021-10-01
  • 2022-12-23
  • 2021-06-18
  • 2021-07-24
  • 2021-12-16
  • 2022-01-22
  • 2021-06-28
相关资源
相似解决方案