I have a class, D, that has a virtual function f. D, in it's constructor, calls f.
E is a class derived from D. It implements f.
D is not apparently calling E::f, but D::f, which gets me a 'pure virtual method called' error.
Anyone? I'm feeling that D doesn't 'see' E, in a sense, and therefore calls its own version. Is there a way around this?
Thanks!
Code: Select all
#include <iostream>
using namespace std;
class D {
virtual void vfc() { }
public:
D() {
vfc();
}
};
class E : public D {
void vfc() {
cout << "Hello" << endl;
}
};
int main() {
E k;
}