Suppose I have a template class defined as,
When I instantiate A, I either use A<B> or use A<C>. Here B and C is just two different types. B and C both define member function bar. My question is that in run time, is there any way I can detect whether p is of B or C? Thanks.Code:template<class T> class A { public: void foo() { T* p = new T; p->bar(); } };




Reply With Quote