[原创][求助]类,派生类,虚函数,构造函数在一段代码中的执行顺序
#include "iostream,h"class I1
{
public:
virtual void func()
{
cout << "I1" << endl;
}
};
class B1
{
public:
B1 (int i)
{
cout <<"B1" << endl;
}
};
class B2 : public I1
{
public:
virtual void func()
{
cout << B2 << endl;
};
B2 (int i)
{
cout << "B2" << i << endl;
func() ;
};
class D1 : public B1 , public virtual B2
{
public:
D1() : B1 (1) , b1(2) , B2 (3) , b2 (4)
{
}
B2 b2;
B1 b1;
};
int main()
{
D1 d;
return 0;
}
请问这段代码输出结果的顺序是什么