填空题

下列程序的输出结果为2,请将程序补充完整。 #inelude<iostream·h> using namespace std; class Base { public: ______ void fun( ){cout<<1;} }; class Derived: public Base { pbulic: void fubn( ){cout<<2;} }; int main( ) {Base*P=new Derived; P→fun( ); delete P; return 0; }

【参考答案】

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

填空题
根据下列程序的执行结果,可以断定划线部分的修饰符应为______。执行结果:i9a football is created.a football is created.i=10a football is destroyed.a football is created.i=20a football is destroyed.a football is destroyed.源程序:#include<iostream.h>class Football{public:Football( ){cout<< a football is created. <<endl;}~Football( ){tout<< a football is destroyed. <<endl;}};void func(int i){______Football f1;Football f2;cout<< i= <<i<<endl;}void main( ){func(10);func(20);}
填空题
完成下列类的构造函数,初始化语句为______。#include<iostream.h>class Test{private:int x,y;public:void Test(int initx,int inity){______}void printx( ){cout<<x<< - <<y<< = <<x-y;}};void main( ){Test x(300,200);x.printx( );}
相关试题
  • 对下列二叉树进行后序遍历的结果是()
  • 设有如下关系表: 则下列操作中正确的是()
  • 在结构化分析方法中,数据字典的作用是
  • 执行下列语句后,输出结果为cout.put('s'...
  • 在长度为n的有序线性表中进行二分查找,需...