全部题库 / C++ / 试题详情
单选题 C++
2008-03-21

有如下程序: 
#include  
using namespace std; 
class Test { 
public: 
Test( ) { n+=2; }  
~Test( ) { n-=3; }  
static int getNum( ) { return n; }  
private: 
static int n;  
}; 
int Test::n = 1; 
int main( ) 
{ 
Test* p = new Test;  
delete p;  
cout << "n=" << Test::getNum( ) << endl; 
return 0;  
} 
执行后的输出结果是(  )

A.n=0  
B.n=1  
C.n=2  
D.n=3

参考答案

A

答案解析

暂无解析

你可能感兴趣的试题