填空题
下列程序的输出结果为2,请将程序补充完整。
#include <iostream>
using namespace std;
class Base
public:
______ void fun()cout<<1;
;
class Derived:public Base
public:
void fun() cout<<2;
;
int main()
Base*p=new Derived;
p->fun();
deletep;
return 0;
【参考答案】
virtual
点击查看答案
<上一题
目录
下一题>
热门
试题
填空题
在MyClass类的定义中,对赋值运算符=进行重载。请将画线处缺失的部分补充完整。 ______MyClass::operator=(const MyClass& ths) if (this==&rhs) return *this; value=ths.value; return *this;
点击查看答案
填空题
一棵二叉树第六层(根结点为第一层)的结点数最多为______个。
点击查看答案
相关试题
阅读下面程序: #include <iostream.h...
下列程序运行后的输出结果是______。...
假设int a=1,b=2;,则表达式(++a...