单项选择题

ClassA是一个类,且有如下语句序列ClassA c1,*c2;ClassA *c3=new MyClass;ClassA &c4=c1;则ClassA的构造函数被调用的次数是

A.1
B.2
C.3
D.5
<上一题 目录 下一题>
热门 试题

单项选择题
有如下程序:#include#includeusing namespace std;class Animal{public:virtual string GetType() const { return Animal ; }virtual string GetVoice() const { return Voice ; }};class Dog:public Animal{public:string GetType() const { return Dog ; }string GetVoice() const { return Woof ; }};class Cat:public Animal{public:string GetType() const { return Cat ; }string GetVoice() const { return Miaow ; }};void Type(Animal& a) { cout<<a.GetType(); }void Speak(Animal& a) { cout<<a.GetVoice(); }int main() {Dog d; Type(d); cout<< speak ; Speak(d); cout<< - ;Cat c; Type(c); cout<< speak ; Speak(c); cout<<endl;return 0;}运行时的输出结果是
A.DogspeakVoice-CatspeakVoice
B.DogspeakWoof-CatspeakMiaow
C.AnimalspeakVoice-AnimalspeakVoice
D.AnimalspeakWoof-AnimalspeakMiaow
单项选择题
执行语句序列 int n=0; for (int i=60; i>0; i-=3) n++;之后,变量n的值是
A.20
B.21
C.60
D.61
相关试题
  • 下列关于函数模板的表述中,正确的是
  • 请使用VC6或使用【答题】菜单打开考生文件...
  • 请使用“答题”菜单或使用VC6打开考生文件...
  • 请使用VC6或使用【答题】菜单打开考生文件...
  • 有如下类声明: class Te{ public: T...