填空题

下面程序的输出结果是 【13】 。 #include <iostream> using namespace std; class A { int a, b; public: A() { a = b = 0; } A(int aa, int bb ) : a(aA) , b(bB) { cout <<"a="<<a<<","<<"b="<<b<<","; } ~A() { cout<<"D"; }; int main ( ) { A x, y(2, 3); return 0; }

【参考答案】

a=B,b=CDD
<上一题 目录 下一题>
热门 试题

填空题
有以下程序:#include <fstream>#include <string>using namespace std;int main (){char ch[] = The end ;ofstream outstr( d: put.txt , ios_base: :app);for (int i = 0; i < strlen( ch ); i++ )outstr.put(ch[i]);outstr.close();return 0;}程序实现的功能是 【15】 。
填空题
若有以下程序:#include <iostream>using namespace std;class Base{public:void who(){cout<< class Base <<end1;}};class Derivedl : public Base{public:void who(){cout<< class Derivedl <<end1;}};class Derived2 : public Base{public:void who(){cout<< class Derived2 <<end1;}};int main(){Base *p;Derivedl obj1;Derived2 obi2;p=&obj 1;p=&obj2;p->who ( );return 0;}则该程序运行后的输出结果是 【14】 。
相关试题
  • 下面程序是一个堆栈的类模板,在横线处填上...
  • 实现编译时的多态性的机制称为 【10】 ...