A-A+
分析以下程序的执行结果【 】。 include <iostream. h> class S{
问题详情
分析以下程序的执行结果【 】。
include <iostream. h>
class S{
int A[10];
public:
int &operator () (int);
};
int &S: :operator() (int x) {
return A[x];
}
void main() {
S a;
int i,j;
for (i=0; i<10; i++)
a(i)=i*2;
for (i=0; i<10; i++)
cout<<a(i)<<" ";
cout<<end1; }请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:0 2 4 6 8 10 12 14 16 18
0 2 4 6 8 10 12 14 16 18