#include<iostream>
using namespace std;

class Parent {
public:
    Parent():a(100),b(200),c(300)
    {
        cout << "parent 构造。。。\n";
    }
    ~Parent()
    {
        cout << "Parent 析构。。。\n";
    }
    int a;
    int b;
    int c;
    void p_print()
    {
        cout << "a b c is" << a << " " << b << " " << c << endl;
    }

};
class Child1 :virtual public Parent
{
public:
    Child1() :Parent(), a(0), b(0), c(0) { cout << "child1 构造\n"; }
    ~Child1()
    {
        cout << "child1 析构,,,\n";
    }
    void c_print()
    {
        cout << "a b c is" << a << " " << b << " " << c << endl;
    }
    int a;
    int b;
    int c;
};
class Child2 :public Parent
{
public:
    Child2() :Parent(), a(1), b(2), c(3) { cout << "child 2构造\n"; }
    ~Child2()
    {
        cout << "child 2析构,,,\n";
    }
    void c_print()
    {
        cout << "a b c is" << a << " " << b << " " << c << endl;
    }
    int a;
    int b;
    int c;
};
class Child3 :public Child1,public Child2
{
public:
    Child3() :Parent(),Child1(),Child2(), a(10), b(20), c(30)
       { cout << "child3 构造\n"; }//如果前面没有使用虚继承,这里初始化Parent构造函数将出错
    ~Child3()
    {
        cout << "child 3析构,,,\n";
    }
    void c_print()
    {
        cout << "a b c is" << a << " " << b << " " << c << endl;
    }
    int a;
    int b;
    int c;
};
int main()
{
    Child3 c3;

    return 0;
}