J
joe
Clearly I can't have a virtual template member function.
What I want to do is pass input of _any_ type, and operate on it in a
finite number of ways
what I really want to do is:
class DataHolder
{
template<typename T>
void execute(T* input) {
handler->execute(input)
}
Handler *handler;
};
class Handler
{
template<typename T>
virtual void execute(T* input) = 0; // Have the derived types handle
this call <--Not C++
};
Where I have many Handlers who mostly act the same, and have most of
the same functions (I really want Inheritance here).
I don't know the input type or the Handler type until runtime, so
neither class can be templated.
Any ideas? The goal is to have another user be able to write code:
DataHolder dataHolder;
dataHolder.execute(myFavType* data);
What I want to do is pass input of _any_ type, and operate on it in a
finite number of ways
what I really want to do is:
class DataHolder
{
template<typename T>
void execute(T* input) {
handler->execute(input)
}
Handler *handler;
};
class Handler
{
template<typename T>
virtual void execute(T* input) = 0; // Have the derived types handle
this call <--Not C++
};
Where I have many Handlers who mostly act the same, and have most of
the same functions (I really want Inheritance here).
I don't know the input type or the Handler type until runtime, so
neither class can be templated.
Any ideas? The goal is to have another user be able to write code:
DataHolder dataHolder;
dataHolder.execute(myFavType* data);