Karthik said:
matt said:
example:
FunClass myfun; FunClass *lotsofunptr=&myfun;
myfun[string]; //calls the overloaded [] operator;
Assuming string to be a variable, (a bad choice for naming it
though) and of the same type as the overloaded function would expect ,
here it goes.
myfun[string] ;
is essentially
myfun.operator[](string)
How does your signature of the overloaded function look like ?
And what is 'string' . C++ std. specifies it to be a type in std
namespace.
lotsofunptr->[string];//error
So if you want to get the same thing as that of a pointer , use
(*lotsofunptr)[string];
You essentially dereference the pointer and apply the same syntax.
If you are not happy then use
lotofunptr->operator[](string)
That should work fine too.