填空题

下列程序的输出结果为2,请将程序补充完整。
using namespace std;
class Base
public:
【12】 void fun() cout<<1;
;
class Derived:public Base

public:
void fun() cout<<2;
int main()

Base*p=new Derived;
p->fun();
delete p;
return 0’;

【参考答案】

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

填空题
下列程序运行后的输出结果是 【15】 。 #include<iostream.h> void fun(int,int,int *); void main() int x,y,z; fun(5,6,&x); fun(7,x,&y); fun(x,y,&z); cout<<x<< , <<y<< , <<z<<endl; void fun(int a,int b,int *c) b+=a; *c=b-a;
填空题
阅读下面程序: #include<iostream.h> void f(int n) int x(5); static int y(10); if(n>0) ++x; ++y; cout<<x<< , <<y<<endl; void main() int m(1); f(m), 则该程序的输出结果是 【14】 。
相关试题
  • 下列关于C++语言类的描述中错误的是( )。
  • C++语言本身没有定义I O操作,但I O操...
  • 多态性指的是( )。
  • 关于关键字class和typename,下列描述正确...
  • 带有虚基类的多层派生类构造函数的成员初始...