What is this? "this->operator [](mySize)"

Hi!

As a C and Java programmer, I thought that C++ should be at least readable to me. I mean, I have got google and such. But some code is realy tricking me, and it's not googleable.

What's happening at the bottom row?!? (What the method does I know, it's the "this->operator [](mySize)" I'm confused about.)

1
2
3
4
5
6
7
define DWORD unsigned long

DWORD mySize;
string myString;
myString = "Hello";

this->operator [](mySize) = ConvertXToDWORD(myString)
it's a confusing way to call the overloaded [] operator.

1
2
3
4
this->operator [](mySize) = foo;

// is the same as
(*this)[mySize] = foo;
The reason C++ offer operator overloading is to act as syntactic sugar for our developer eyes. The author defeat all the purpose by explicitly calling operator[] which is redundant. I would go for Dish solution as it looks "natural" to me :P
Topic archived. No new replies allowed.