问答题
使用VC6打开考生文件夹下的源程序文件modil.cpp,该程序运行时有错,请改正其中的错误,使程序正确运行,并且使程序输出的结果为: CMyObject,in the construtor CMyObject,in the destrutor 注意:错误的语句在∥********error********的下面,修改该语句即可。 #include
class CMyObj ect { ∥********error******** ∥********error******** CMyObj ect{cout<<“CMyObj ect,in the construtor”<
【正确答案】
正确答案:(1)添加语句:public: (2)CMyObj ect(){cout<<“CMyObj ect,in the construtor”<
【答案解析】
解析:程序中定义了类CMyObject,含有一个构造函数和一个析构函数,在构造函数和析构函数中分别输出一段字符。
提交答案
关闭