填空题
下面程序编译时发现ma[3]=9错误,其原因是______。
#include<iostream.h>
class FunArray
{
int*pa; //指向一个数组空问
int size; //数组元素个数
public:
FunArray(int a[],int thesize):pa(a),size(thesize){}
int Size( ){return size;}
}
};
void main( )
{
int s[]={3,7,2,1,5,4};
FunArray ma(s,sizeof(s)/sizeof(int));
ma[3]=9;
cout<<ma[3]<<endl;
}
【参考答案】
没有重载[]运算符