[求助]实在不好意思,请达人帮忙看看错在哪里。
#include <iostream.h>class base {
protected:
int a;
public:
base( )
{ a=5; cout<<"base a="<<a<<endl; }
};
class base1:virtual base {
public: base1( )
{ a=a+10; cout<<"base1 a="<<a<<endl; }
};
class base2:virtual base {
public: base2( )
{ a=a+20; cout<<"base2 a="<<a<<endl; }
};
class derived :public base1,public base2 {
public:
derived( )
{ cout<<"derived中a="<<a<<endl;
}
};
void main( )
{
derived obj;
}