#include <iostream>
class Target
{
public:
Target(){}
virtual void Request(){std::cout << "Target::Request"<< std::endl;}
virtual ~Target(){}
};
class Adapte
{
public:
Adapte(){}
~Adapte(){}
void SpecificRequest()
{
std::cout<<"Adapte::SpecificRequest"<<std::endl;
}
};
class Adapter : public Target,private Adapte
{
public:
Adapter(){}
~Adapter(){}
void Request()
{
this->SpecificRequest();
}
};
int main()
{
Target *adt = new Adapter;
adt->Request();
}
适配器模式
最新推荐文章于 2021-01-17 23:21:05 发布