Hi there,
I'm so frustrated now =(
I have read the forums and this http://www.goingware.com/tips/member-pointers.html
But i still cannot get this to work:
class FileParser
{
public:
void load(char* file)
{
MyDocumentClass _mDoc;
_mDoc.LoadFile(file);
// is this correct syntax?
parse(_mDoc, &(FileParser::saveElement));
// or is this correct?
parse(_mDoc, &(this->saveElement));
}
private:
typedef void (FileParser::*ParseAction)(MyDocumentClass* doc);
void parse(MyDocumentClass* doc, ParseAction action)
{
if(condition_met)
{
// is this syntax correct?
(this->*action)(doc);
}
}
void save(MyDocumentClass* doc){}
void print(MyDocumentClass* doc){}
// etc...
}
I believe it is different than that described in the web article.....?
Hope someone can point out my mistake in the code.