阅读以下程序class A{protected: int a=0;public: A(){a=1;}};class B:virtual public A{public: B(){a++;}};class C:virtual public A{public: C(){a+=2;}};class D:public B,public C{public: void print(){ cout<
A: 0
B: 1
C: 3
D: 4
A: 0
B: 1
C: 3
D: 4
举一反三
- 下列虚基类的声明中正确的是( )。 A: class virtual B:public A B: virtual class B:public C: class B:public A virtual D: class B: virtual public A
- 下列虚基类的声明中,正确的是________。 A: class B:public A B: class B:virtual public A C: virtual class B:public A D: class virtual B:public A
- 定义虚基类的说明中,正确的格式是( ) A: virtual class B:public A B: class virtual B:public A C: class B:virtual public A D: class B:public A virtual
- 下列虚基类的声明中正确的是( )( ) A: public A <br/>B、class B: virtual public A <br/>C、class C: public A virtual <br/>D、class D: public virtual A <br/>E、virtual class E: public A
- 下列虚基类的声明中正确的是( )[br][/br]· A: class virtual B: public A<br>· B、class B: virtual public A<br>· C: class B: public A virtual<br>· D: virtual class B: public A