使用VC6打开考生文件夹下的工程test4_1,此工程包含一个源程序文件test4_1.cpp,但该程序在类的定义中存在问题,请改正类定义中的错误,使程序的输出结果如下:

a=3 b=13 a=5 b=13 注意:请勿修改主函数main中的任何内容。 源程序文件rcst4_1.cpp清单如下: include<iostream.h> class T { public: /*********found***+******/ T(int x){a=x; b+=x;) /+********found**********/ void display(T c) { cout<<"a="<<c.a<<"\t"<<"b="<<c.b<<endl;) private: const int a; static int b; }; /**********found*********/ int b=5; void main() { T A(3),B(5); T::display(A); T::display(B); }

时间:2023-10-03 16:53:31

相似题目