What is the best way to implement the adaptor pattern in c++ -


i have seen possible use inheritance, such as:

class { };  class legacy{ };  class b : public a, private legacy { }; 

but weird me inherit public , private 2 different classes. there alternative way implement adapter pattern?

generally better use composition instead of inheritance adapters (and many other cases too):

class b : public {   public:     /* implementation of abstract methods of calls legacy */    private:     legacy m_leg; }; 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -