Let’s say I have this :
class A
{
virtual int Method2(){/*...*/}
};
template<typename T>
class B<T> : public A
{
public :
virtual int Method1(){/*...*/}
virtual int Method2(){/*...*/}
};
Is it possible to do something similar to this (this does not work of course…) ?
A* a = ...;
B* b = dynamic_cast<B*>(a);
b->Method1();
Thanks
What people normally do is have an intermediary class.
This is known as type erasure. However, in this system, A doesn’t really serve much purpose.