Hello!
My application have to handle 3 kind of classes while runtime.... I am lookig for a solution that simplifies the following code...
I don`t need a polymorphic solution with a base class. The problem is that I have no access to to framework i am using and the types have only the IBaseFilter in common. But I don't want to call the methods of the base class!!!Code:IBaseFilter *rendererBasePtr = ....;
PtrType type = VR; //possible other types VMR7 VMR9
if( type == VR )
dynamic_cast<IVideoRenderer*>(rendererBasePtr)->function1();
else if( type = VMR7 )
dynamic_cast<IVideoRenderer7*>(rendererBasePtr)->function2();
else if( type = VMR7 )
dynamic_cast<IVideoRenderer9*>(rendererBasePtr)->function3();
So I am looking for a template/union/... solution that simplifies the code above and let me access the correct interfaces transparently.
Thanks in advance
