填空题
下列程序的输出结果是______。
#include <iostream>
using namespace std;
class Test
public:
Test()cnt++;
~Test() cnt--;
static int Count() return cnt;
private:
static int cnt;
;
int Test::cnt=0;
int main()
cout<<Test::Count()<<’’;
Test t1,t2;
Test*pT3=new Test;
Test*pT4=new Test;
cout<<Test::Count()<<’’;
delete pT4;
delete pT3;
cout<<Test::Count()<<endl;
return 0;
【参考答案】
042
点击查看答案
<上一题
目录
下一题>
热门
试题
填空题
创建对象数组时,对数组的每一个元素都将调用一次构造函数,如果没有显式给出数组元素的初值,则调用缺省构造函数。下列程序涉及对象数组的创建和单个对象的创建,其输出结果是______。 #include <iostream> using namespace std; class Foo public: Foo(int x)cout<<’A’; Foo() ; int main() Foo f[3], g(3); return 0;
点击查看答案
填空题
浮点数的默认精度值是______。
点击查看答案
相关试题
以下程序的执行结果是______。 #in...
已知:double A(double a)return ++...
下列程序的输出结果是______。 #in...
下列程序的输出结果是______。 #in...