class B3 { public: B3(int i) { b3 = i; cout<<"构造函数 B3."< } int getb3() { return b3; } private: int b3; }; class A : public B2, public B1 { public: A(int i, int j, int k, int l):B1(i), B2(j), bb(k) { a = l; cout<<"构造函数 A."< } void print() { B1::print(); B2::print(); cout< } private: int a; B3 bb; };
class A { public: int a; }; class B1 : public A { private: int b1; }; class B2 : public A { private: int b2; }; class C : public B1, public B2 { public: int f(); private: int c; };