#include <cstdlib>
#include <iostream>
usingnamespace std;
int LEN = 10;
int j = 0;
int k = 0;
//////////////////////////////////////////
class parray
{
private:
int* ap[];
public:
parray()
{ ap[LEN]; }
voidoperator [] (int boyut)
{
ap[boyut];
for(int i = 0; i<boyut; i++)
*(ap+i) = newint[10];
}
intoperator [] (int z)
{
for(j = 0; j < z; j++)
for(k = 0; k < z; k++)
*(*(ap+j)+k) = 10*k ;
return ap[j][k];
}
};
int main(int argc, char *argv[])
{
int* ap[LEN];
for(int i = 0; i < LEN; i++)
*(ap+i) = newint[10];
for(int j = 0; j < LEN; j++)
for(int k = 0; k < LEN; k++)
*(*(ap+j)+k) = 10*k ;
for(int j = 0; j < LEN; j++)
for(int k = 0; k < LEN; k++)
cout << ap[j][k] << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
hi.I take this error " `int parray::operator[](int)' and `void parray::operator[](int)' cannot be overloaded "
parray have a problem I know this.but i want to for example
parray pa[10];
for(int i = 0; i<LEN; i++)
cout<<pa[i]<<endl;
etc...main program is working but i want to make with class and [] operator.thank u.