填空题

带有虚基类的多层次派生类构造函数的成员初始化列表中都要列出虚基类的构造函数,这样对虚基类的子对象初始化 【10】 次。

【参考答案】

一次
<上一题 目录 下一题>
热门 试题

填空题
如下程序执行后的输出结果是 【14】 。 #include <iostream> using namespace std; class Base public: Base(int x,int y) a=x; b=y; void Show() cout<< Base: <<a<< ’,’ <<b<< ; private: int a,b; ; class Derived : public Base public: Derived(int x, int y, int z) : Base(x,y),c(z) void Show() cout<< Derived: <<c<<end1; private: int c; ; int main() Base b(100,100),*pb; Derived d(10,20,30); pb=&b; pb->Show(); pb=&d; pb->Show(); return 0;
填空题
在下面程序横线处填上适当内容,使得程序的输出为9876。 #include <iostream> using namespace std; template<class T> void f( 【12】 ) T t; for (int i=0;i<n 2;i++) t=a Ii]; a [i]=a[n-1-i]; a [n-1-i]=t; int main ( ) int x[]=6,7,8,9; f(x,4); for (int i=0;i<4;i++) cout<<x[i]; cout<<end1; return 0;
相关试题
  • 以下程序设计功能是:将结构体变量time 中...
  • 有以下程序: #include <iostream> u...
  • 在成员函数声明的前面加上关键词 【11】...