Created
April 21, 2022 10:57
-
-
Save mlcollard/d29659fcc31e75e22f1eb8c046eeb917 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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