问题
填空题
下列程序的运行结果是______。 #include<iostream.h) class test { private: int num; public: test(); int TEST(){return num+100;} ~test(); }; test::test(){num=0;} test::~test(){cout<<"Destructor is active"<<endl;} void main() { test x[3]; cout<<x[1].TEST()<<end1; }
答案
参考答案:100
解析:Destructor is active Destructor is active Destructor is active。 本题考查考生基本的类的定义,构造函数以及对象数组的概念。