Karthik Kumar wrote:[color=blue]
> matt p wrote:
>[color=green]
>> example:
>> FunClass myfun; FunClass *lotsofunptr=&myfun;
>>
>> myfun[string]; //calls the overloaded [] operator;[/color][/color]
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)
[color=blue]
>
>
> 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.
>[color=green]
>>
>>
>> lotsofunptr->[string];//error[/color][/color]
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.
[color=blue][color=green]
>>[/color]
>
> Post compilable code here to seek help.
>[/color]
--
Karthik.
http://akktech.blogspot.com .
'Remove _nospamplz from my email to mail me.'