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
Post a Comment