填空题
带有虚基类的多层次派生类构造函数的成员初始化列表中都要列出虚基类的构造函数,这样对虚基类的子对象初始化 【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;