Why does this code:
class A { public: explicit A(int x) {} }; class B: public A { }; int main(void) { B *b = new B(5); delete b; }
You have to explicitly define the constructor in B and explicitly call the constructor for the parent.
B(int x) : A(x) { }
or
B() : A(5) { }