[LC++]couple of questions (was: Re: testing)
Mark Phillips
mark at austrics.com.au
Wed Oct 31 11:24:45 UTC 2001
Carlo Wood wrote:
>
> this is not an array, so you should be using operator[].
> this[i] is nonsense.
Okay, I think I know where I went wrong. My understanding is that with
an array, "int myArray[30];" for example, then "myArray" refers both
to the entire array and to a pointer to myArray[0]. So there is a
degree of ambiguity. Now an object can be made to look like an array,
using "operator[]". My thought was that perhaps this same type of
ambiguity was available for objects made to look like an array. But
where I am probably getting confused is that myArray is a pointer
to "int", not a pointer to "myArray[30]", which is the equivalent of
what "this"
points to.
Cheers,
Mark.
More information about the tuxCPProgramming
mailing list