填空题 下面程序的输出结果是 【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;


  • 1、
【正确答案】 1、a=2,b=3DD    
【答案解析】[解析] 本题主要考核构造函数与析构函数的应用。主函数中定义 A类对象x时无输出,定义对象y时调用构造函数输出a=2,b=3。在主函数结束前,对象x,y都调用各自的析构函数输出DD。所以最后答案为a=2,b=3DD。