operator->
is not the array operator. None of the C++ operators is officially called that way, but the one that fits that name best would be the indexingopeator[]
.- What you want is not possible. In
b->c
, however that might be implemented,c
is a symbol, i.e. the name of some variable or function."c"
on the other hand is a string literal, and the first cannot be converted to the latter (except by some black preprocessor magic, which does not fit in the expressionb->c
).
You might want to look up how overloading operator->
works, because it is special in the sense that it has to return either a pointer or another object that has operator->
overloaded. The compiler will call the ->
on any returned object until it truly dereferences a pointer.