填空题
在成员函数声明的前面加上关键词 【11】 修饰,即把该函数声明为虚函数。
【参考答案】
virtual
热门
试题
填空题
如下程序执行后的输出结果是 【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;