标签:
class Base { public: Base(int i) { cout << i; } ~Base() { } }; class Base1: virtual public Base { public: Base1(int i, int j=0) : Base(j) { cout << i; } ~Base1(){} }; class Base2: virtual public Base { public: Base2(int i, int j=0) : Base(j) { cout << i; } ~Base2(){} }; class Derived : public Base2, public Base1 { public: Derived(int a, int b, int c, int d) : mem1(1), mem2(2), Base1(3), Base2(4),Base(1) { cout << b; } private: Base2 mem2; Base1 mem1; }; int main(int argc, char **argv) { Derived objD (1, 2, 3, 4); getchar(); return 0; }
标签:
原文地址:http://www.cnblogs.com/kaishan1990/p/5567789.html