整专业资料
微信QQ群
考生网QQ群

群号:517231281

扫码加群
点击二维码加群

考生网微信公众号

微信号:zikaosw

课程试听
最新资讯

手机端访问

1、直接输入www.zikaosw.cn
2、扫描左侧二维码

登录 | 注册
登录/注册后,可享受
  • 课程免费试听
  • 试做在线题库
  • 学习提升指导
  • [主观题] 【完成程序题】下面程序中A是抽象类。请在下面程序的横线处填上适当内容,以使程序完整,并使程序的输出为:
    B1 called
    B2 called
    #include
    class A
    {
    public:
    ①            ;
    };
    class B1:public A
    {
    public:
    void display( ){cout<<”B1 called”<};
    class B2:public A
    {
    public:
    void display( ){cout<<”B2 called”<};
    void show(②        )
    {
    p->display( );
    }
    void main( )
    {
    B1 b1;
    B2 b2;
    A* p[2]={&b1,&b2};
    for(int i=0;i<2;i++)
    show(p[i]);
    }

     纠错    

  • 助考班推荐

您可能感兴趣的试题

  • 1、[单选题]重载二元运算符@为类X的友元运算符,设有两个对象obj1和obj2,则表达式obj1@obj2被C++编译器解释为

    • A、obj1.operator@(obj2)
    • B、obj2.operator@(obj1)
    • C、operator@(obj1,obj2)
    • D、operator@(obj2)
  • 2、[主观题]下面是以传统形式的struct来定义一存放字符的栈类型,并定义了有关栈操作的各种函数。编写一主函数,定义并输入一个字符串,用此串来验证栈的各种操作,包括把串压入栈中后再弹出,以相反的次序将它们显示出来。#include″iostream.h″constmax—len=1000;enunboolean{—false,—true};enum{EMPTY=-1,FULL=max—len-1};structstack{chars[max—len];inttop;};voidreset(stack*st){st->top=EMPTY;}voidpust(charc,stack*st){st->top++;st->s[st->top]=c;}charpop(stack*st){return(st->s[st->top--]);}chartop(stack*st){return(st->s[st->top]);}booleanempty(conststack*st){return(boolean)(st->top==EMPTY);}booleanfull(conststack*st){return(boolean)(st->top==FULL);}

  • 3、[主观题]面向对象程序设计的___机制提供了重复利用程序资源的一种途径。

  • 4、[主观题]写出下面程序的输出结果。#includeclasslocation{intX,Y;public:voidinit(int=0,int=0);voidvalueX(intval){X=val;}intvalueX{returnX;}voidvalueY(intval){Y=val;}intvalueY{returnY;}};voidLocation::init(intinitX,intinitY){X=initX;Y=initY;}voidmain{LocationA,B;A.init;cout

  • 5、[主观题]对虚函数使用基类类型的指针或引用调用,系统使用___联编;而使用对象调用时,系统使用___联编。

Copyright © 2010 - 2023 湖南求实创新教育科技有限公司 All Right Reserved.

温馨提示:如您需要的资料本网暂时没有,请于工作日08:00-18:00,点击这里,联系客服及时补充资料。