As Kerrek SB mentions, you need to initialize A
in the constructor for D
.
However, you must also explicitly tell the compiler that you are not accessing A
from its (privately) derived context by using the scope operator.
class D : public C {
public:
D(void) : ::A(3), C(3) { }
// ^^ Access this constructor from a global context
using C::getVirt;
};
This also means that your constructor must be public, as is already the case with your code.