コード
#include <iostream>
#include <string>
using namespace std;
class Adaptee{
public:
Adaptee(string name){
this->name = name;
}
void print(){
cout << "The name is " << name;
}
private:
string name;
};
class Target{
public:
virtual void printWithBracket() = 0;
};
class Adapter: public Target{
public:
Adapter(string name){
adaptee = new Adaptee(name);
}
void printWithBracket(){
cout << "\"";
adaptee->print();
cout << "\"";
cout << endl;
}
private:
Adaptee* adaptee;
};
int main(){
Target *t = new Adapter("adapter");
t->printWithBracket();
return 0;
}