Yes, it can be in the template class, but it can NOT be a virtual
template member function
I don't understand how it could be pure, but not a member.
In any case, here is code that works on my system showing
exactly what I mean.
Mike.
// virt_temp.cc 07/10/08
#include <iostream>
using namespace std;
template <class TYP>
class BaseT
{
protected:
BaseT(TYP x,TYP y) : x_(x),y_(y){}
void doAll(){cout << "x_="<<x_<<',';doChild(y_);cout<<endl;}
virtual void doChild(TYP a)=0;// pure virtual member function
private:
TYP x_;
TYP y_;
};
class Child : protected BaseT<int>
{
public:
Child() : BaseT<int>(1,2){}
void doThings(){doAll();}
private:
virtual void doChild(int a);
};
void Child::doChild(int a){cout<<"a="<<a;}
int main(int argc, const char* argv[])
{
Child child;
child.doThings();
}