下面程序的结果是( )。 #include<iostream.h> class test{ private: int num; public: test( ); int getint( ) {return num;} ~test( );}; test::test( ) { num=0;} test::~test( ) { cout<<"Destructor is active"<<endl;} void main( ) { test x[3]; cout<<"Exiting main"<<endl;}
A. Exiting main Destructor is active Destructor is active Destructor is active
B. Exiting main Destructor is active Destructoris active
C. Exiting main Destructoris active
D.Exiting main
参考答案:A
解析:C++语言中析构函数是在程序退出不用该类的对象时进行调用。