假设我有一个基类:
class baseClass { public: baseClass() { }; };
派生类:
class derClass : public baseClass { public: derClass() { }; };
解决方法
做额外的空ctor.
struct noprapere_tag {}; class baseClass { public: baseClass() : x (5),y(6) { }; baseClass(noprapere_tag) { }; // nothing to do protected: int x; int y; }; class derClass : public baseClass { public: derClass() : baseClass (noprapere_tag) { }; };