请使用VC6或使用【答题】菜单打开考生文件夹projl下的工程projl。程序中位于每个“//ERROR****found料****之后的一行语句有错误,请加以改正。改正后程序的输出结果应为: Name:Smith Age:21 ID:99999 CourseNum:12Record:970注意:只修改每个“//ERROR****found****”下的那一行,不要改动程序中的其他内容。 #includeusing namespace std; class Studentlnfo{protected: //ERROR********************found****************char Name; int Age; int ID: int CourseNum; float Record; public: Studentlnfo(char*name,int Age,int ID,int coumeNum,float record); //ERROR ********************found********************void~Studentlnfo(){}float AverageRecord(){return Record/CourseNum; }void show()const{cout
查看答案
对类的构造函数和析构函数描述正确的是( )。
A. 构造函数可以重载,析构函数不能重载
B. 构造函数不能重载,析构函数可以重载
C. 构造函数可以重载,析构函数也可以重载
D. 构造函数不能重载,析构函数也不能重裁
有如下类声明: class Base{protected: int amount; public: Base(int n=0):amount(n){}int getAmount()const{retum amount;}}; class Derived:public Base{protected: int value; public: Derived(int m,int n):value(m),Base(n){}int getData()const{return value+amount;}}: 已知x是一个Derived对象,则下列表达式中正确的是( )。
A. x.value+X.getAmount()
B. x.getData()一x.getAmount()
C. x.getData()一x.amount
D. x.value+X.amount
下列关于c++流的描述中,错误的是( )。
A. cout>>’A’表达式可输出字符A
B. eof()函数可以检测是否到达文件尾
C. 对磁盘文件进行流操作时,必须包含头文件fstream
D. 以ios_base::0ut模式打开的文件不存在时,将自动建立一个新文件
如果派生类以proteCted方式继承基类,则原基类的proteCted成员和publiC成员在派生类中的访问属性分别是( )。
A. publiC和publiC
B. publiC和proteCted
C. proteCted和publiC
D. proteCted和proteCted