Original Post
I'm attempting to use a macro to handle load variables into a class, however instead of using the variable directly what I have attempted to do is to call the function to set the variable within it, I have done a working one however I'm struggling to make it generic and I don't want to make a macro per class for it, could anyone give any advise on how to best achieve this?
// The macro
#define STRINGREAD( sKey, sFunc ) { if( CompareStr( strWord, sKey ) ) { ( MyClass1->*(sFunc) )( FileReadString( pFile ) ); bFound = true; } }
// To load a string and set i call
STRINGREAD( "Name", &MyClass1::SetName );
So again in short, I'm wanting to use a macro but have it handle other classes aswell instead of just MyClass1.