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: 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
- 定义虚基类的说明中,正确的格式是( ) A: virtual class B:public A B: class virtual B:public A C: class B:virtual public A D: class B:public A virtual
- 阅读以下程序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
内容
- 0
有以下类定义: class A{int x;};class B:virtual public A{int y;};class C:virtual public A{int z;};class D:public B, public C{};则对于 D 类对象 d,以下正确的选项是( )。 A: 有 3 个成员 B: 有 4 个成员 C: 没有成员 D: 有 2 个成员
- 1
若有如下类,则执行语句 A *a=new B(10); delete a;输出结果为()。 class A{ public: virtual ~A{ cout< }; class B:public A{ char *buf; public: B(int i) { buf=new char[i]; } virtual ~B{ delete []buf; cout< } };
- 2
abstract class BaseClass { public virtual void MethodA() { } public virtual void MethodB() { } } class Class1: BaseClass { public void MethodA(string arg){ } public override void MethodB(){ } } class Class2: Class1 { new public void MethodB(){ } } class MainClass { public static void Main(string[] args) { Class2 o = new Class2(); Console.WriteLine(o.MethodA()); } } 请问,o.MethodA调用的是 A: BaseClass.MethodA B: Class2.MethodA C: Class1.MethodA D: 都不是
- 3
下面的程序段中虚函数被重新定义的方法正确吗?class base{public:virtual int f(int a)=0;......};class derived: public base{public:int f(int a,int b){return a*b;}......};
- 4
下列哪个类声明是正确的( ) A: public void A1{…} B: public class Move(){…} C: public class void number{…} D: public class Car{…}