S
Steve
Hi,
I have two classes: pair, and Array. In Array, I have overloaded the
subcript operator like this:
pair& operator[] (int index) {
return pair(index);
}
However, it results in a compilation error saying that there's not
suitable funtion that returns a 'pair' when I do:
pair a = myArray[0];
It seems to be always returning a reference of type Array. How can I
make it return another type? Thanks,
Steve
I have two classes: pair, and Array. In Array, I have overloaded the
subcript operator like this:
pair& operator[] (int index) {
return pair(index);
}
However, it results in a compilation error saying that there's not
suitable funtion that returns a 'pair' when I do:
pair a = myArray[0];
It seems to be always returning a reference of type Array. How can I
make it return another type? Thanks,
Steve