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