hmm stuck with this problem:
i'd like to have a template function in an interface, for e.g.:
Code:
class interface {
virtual void somefun(int)=0;
template<typename T>
/*virtual not possible*/ void anotherfun(T)/*=0*/;
}
class SomeObject : public interface{
void somefun(int i) {
...
}
template<typename T>
void anotherfun(T t) {
...
}
}
void doSomething(Interface &i) {
i.somefun(30);
/*following line gives linker error*/
i.anotherfun(23);
}
int main() {
SomeObject so;
doSomething( so );
}
is it impossible to create a virtual template function ? (why?)
is there another solution to this problem ?
thanks
cla