Why do I have to specify virtual functions in the declaration of a derived class?
- by neuviemeporte
Given the base class A and the derived class B:
class A {
public:
virtual void f();
}
class B : public A {
public:
void g();
}
I get errors saying that f() is not declared in B while trying do define void B::f(). Do I have to declare f() explicitly in B? I think that if the interface changes I shouldn't have to correct the declarations in every single class deriving from it. Is there no way for B to get all the virtual functions' declarations from A automatically?