Hi all,
I'm back to coding in C++, after a somewhat long stint coding PHP.
I'm rewriting some code, and the way I'd like to deal with it, would be to overload the -> operator, so that I can "call" arbitrary method names, that are assigned at run time by various plugins and libraries that dynamically link to the process.
From what I know, this isn't possible, because the -> operator has to return the function to handle the call, and it does not give us the name of the method...
In pseudo-code:
myClass X;
x.addMethod( "nameHere" );
x.addMethod( "setAge" );
x->setAge( 25 );
- - -
The code, again in pseudo-code:
int operator ->( char* methodName )
{
if( methodName in listOfRegisteredMethods )
{
return methodFunctionPointer();
}
else
{
throw Exception...
};
};
- - -
I know that there have been, recently, changes and updates to the language. I've written myself a lambda function this past week for the very first time. I would just like to know if anything has been added that would allow me to accomplish something like the above.
Thanks for any replies!