Skip to content

Instantly share code, notes, and snippets.

@mlcollard
Created April 21, 2022 10:57
Show Gist options
  • Save mlcollard/d29659fcc31e75e22f1eb8c046eeb917 to your computer and use it in GitHub Desktop.
Save mlcollard/d29659fcc31e75e22f1eb8c046eeb917 to your computer and use it in GitHub Desktop.
class Adaptee {
public:
void specificRequest();
};
class Target {
public:
virtual void request() = 0;
};
class Adapter : public Target, Adaptee {
public:
Adapter()
: Target(), Adaptee()
{}
void request() override {
specificRequest();
}
};
class Adaptee {
public:
void specificRequest();
};
class Target {
public:
virtual void request() = 0;
};
class Adapter : public Target {
public:
void request() override {
adaptee.specificRequest();
}
private:
Adaptee adaptee;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment