V
vilarneto
Hello everyone,
I'm facing a particular situation about template class derivation.
The subject is old -- deriving a non-template class from a template
base class -- but my problem is that the base class has a pure virtual
method. For instance:
template<class T>
class A {
public:
virtual void method() = 0;
};
class B : public A<int> {
public:
// neither of the following worked:
// void method() { }
// void method<int>() { }
// template<int> method() { }
};
int main(int argc, char *argv[]) {
B b;
return 0;
}
This is probably simple, but I couldn't figure out a way to implement
the derived method.
Also, I don't know if this matters, but I'd better stay apart from
compiler idiosyncrasies -- I'm searching for something portable, at
least between g++3.4.4 and VC7.
Does anybody have any hint about this?
I'm facing a particular situation about template class derivation.
The subject is old -- deriving a non-template class from a template
base class -- but my problem is that the base class has a pure virtual
method. For instance:
template<class T>
class A {
public:
virtual void method() = 0;
};
class B : public A<int> {
public:
// neither of the following worked:
// void method() { }
// void method<int>() { }
// template<int> method() { }
};
int main(int argc, char *argv[]) {
B b;
return 0;
}
This is probably simple, but I couldn't figure out a way to implement
the derived method.
Also, I don't know if this matters, but I'd better stay apart from
compiler idiosyncrasies -- I'm searching for something portable, at
least between g++3.4.4 and VC7.
Does anybody have any hint about this?