关于类初始化的问题
有A类 B继承A C继承A D继承B和C类 D类怎样初始化A类里构造函数献上不完整的代码
程序代码:
#include <iostream> using namespace std; class A { public: A (int a) { num=a; } protect: int num; }; class B : public A { public: B (int b) : A (b) {} }; class C : public A { public: C (int b) : A (b) {} }; class D : public B, public C { public: D (int b) //不完整 {} }; void main () {}