the name is probably misleading, but I really did not know what to call it.
let's say I have the following structures
template <typename T>
struct SillyBase{
void doFunnyStuff(vector<T> vec){
dummyField = T();
for(int i=0; i<10; i++)
vec.push_back(dummyField++);
}
T dummyField;
};
struct A : public SillyBase<char>{};
struct B : public SillyBase<float>{};
Now let us further assume that I have a pointer
ISillyBase* ptr;
which points to an object of class DECENDANT (A or B) SillyBase - however, I DO NOT KNOW which one (I just know it is either A or B);
Is there any way for me to call doFunnyStuff ()?
maybe something like:
vector<dynamic_generic_type_of(ptr)> vec;
ptr->doFunnyStuff(vec);
thank!
source
share