皮皮学,免费搜题
登录
搜题
【简答题】
使用VC6打开考生文件夹下的工程test12_3,此工程包含一个test12_3.cpp,其中定义了类Base和类A,类A公有继承 Base,但这两个类的定义都并不完整。请按要求完成下列操作,将程序补充完整。 (1)定义枚举类型变量en,它包含两个枚举符front和back,请在注释“//**1**”之后添加适当的语句。 (2)在类Base中添加常成员虚函数void E()的定义,该函数输出“In Base E!”,请在注释“//**2**”之后添加适当的语句。 (3)在类A中添加常成员虚函数void E()的定义,该函数先调用基类中的虚函数 E()再输出“In AE!”,请在注释“//** 3**”之后添加适当的语句。 (4)完成类A构造函数的定义,请使用参数列表的形式初始化类A的成员,并输出“A constructor.”,请在注释“//** 4**”之后添加适当的语句。 输出结果如下: Base constructor. A constructor. In BaseE! In AE! In BaseP! In A! 1 A destructor. Base destructor. 注意:除在指定的位置添加语句外,请不要改动程序中的其他语句。 源程序文件test12_3.cpp清单如下: include<iostream .h> // ** 1 ** class Base { protected: int b1; int b2; public: Base(); ~Base(); int Getb1()const { return b1; } void Setb1(int x){ b1 = x; } int Getb2()const { return b2; } void Setb2(int y) { b2 = y; } void Print()const {cout<<'In Base P!'<<end1;} // ** 2 ** }; Base::Base():b1(1),b2(5) { cout<<'Base constructor.'<<endl; } Base::~Base() { cout<<'Base destructor.'<<endl; } class A:public Base { protected: en enA; public: A(); ~A(); en GetColor()const { return enA; } void SetColor(en color){ enA = color; } void InA(){cout<<'In A!'<<endl;} // ** 3 ** { Base::E(); cout<<'In AE!'<<endl; } }; // ** 4 ** { cout<<'A constructor.'<<endl; } A::~A() { cout<<'A destructor.'<<endl; } void main() { A a1; a1.E(); cout<<endl; a1.Print(); a1.InA(); cout<<a1.Getbl()<<endl; }
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【单选题】It is not until 1768 when______first claimed possession of the eastern part of Australia for his country that the continent began to be explored by Europeans.
A.
James Cook of Britain
B.
William Dampier of Britain
C.
Willem Jansz of the Netherlands
D.
Luis Vaez de Torres of Spain
【单选题】It is not until May, 2013 the online consultation comes to an end the draft will be officially in force.
A.
when; that
B.
that; that
C.
that; when
D.
before; that
【单选题】目前,除了传统的串口和并口外,计算机与外部设备连接的标准接口越来越多。例如,(1)是一种连接大容量存储设备的并行接口,数据宽度一般已为32位,且允许设备以雏菊链形式接入;(2)是一种可热插拔的高速串行设备接口,也可允许设备以雏菊链形式接入;(3)则用来连接各种卡式设备,已广泛使用于笔记本电脑中。空白(1)处应选择()
A.
VESA
B.
USB
C.
SCSI
D.
PCI
【判断题】It is not until in the last stanza that Shelley began to change his angle to "I" in the Ode to the West Wind.
A.
正确
B.
错误
【单选题】It is not until January ,2013 the Presidential election of the United States comes to an end we’ll know who is the new president.
A.
before; that
B.
that; that
C.
that ;when
D.
when ; that
【单选题】It is not until we know more about the situation ______ we are able to improve it.
A.
that
B.
what
C.
when
D.
which
【判断题】晶体管可以把小电流放大成大电流。 ( )
A.
正确
B.
错误
【多选题】收款凭证的贷方科目可能为下列( )科目
A.
应收账款
B.
银行存款
C.
在途物资
D.
主营业务收入
【简答题】It is not until about the time the child enters school that outside forces contributeto feelings about the self.
【多选题】空中接口是( )设备和( )设备的接口。
A.
BTS
B.
BSC
C.
MSC
D.
MS
相关题目: