I'm writing a very simple program. Im supposed to create an object that contains an array in it.
int operator  (int index);
int * Arr;
the point of this small exercise is to be able to do the following:
the idea is to be able to refer to a specific element just like any other built in type array, instead of having to write: mainArr.Arr=7
However, whenever I perform this assignment I get a compilation error:
left operand must be l-value.
When I write the following : i=mainArr there is no problem.
Here's my operator  implementation :
int intArr operator  (int index)
what am I doing wrong here?