It looks like you do need polymorphism, and I addressed this in a different post with regard to adapters.
Ideally you would not need to look up type then cast, but would call a single method in your base class, thus:
Now the adapters could work as follows:Code:rendererBasePtr->callFunction();
That's just an illustration to start you on your way. I'd need to see more code and more information to know exactly what you need.Code:class FilterAdapterBase { public: virtual void callFunction() /*const ?*/= 0; }; class FilterAdapterVR : public FilterAdapterBase { IVideoRenderer * m_pImpl; public: void callFunction() { m_pImpl->function1(); } }; class FilterAdapterVMR7 : public FilterAdapterBase { IVideoRenderer7 * m_pImpl; public: void callFunction() { m_pImpl->function2(); } }; class FilterAdapterVMR9 : public FilterAdapterBase { IVideoRenderer9 * m_pImpl; public: void callFunction() { m_pImpl->function3(); } };




Reply With Quote