Hello

Let me define the problem:

You have a class with a function that enumerates elements in a list. For each object the function calls the supplied callback function:

Code:
void CMyClass::EnumObjects(void (*EnumObjectCallback)(OBJECT))
{
    for each object in the objects list{
        EnumObjectCallback(object);
    }
}
Now, this would work great for a case where the callbackfunction wouldn't be in a class

Code:
void PrintObject(OBJECT);
-----
pMyClass->EnumObjects(&PrintObject);
But when the callback function is in another class, there will be problem.
Code:
void CAnotherClass:rintObject(OBJECT);
-----
pMyClass->EnumObjects(&pAnotherClass->PrintObject);
This is where the problem is. Since I wont be knowing the classtype of the class I cant define the enum finction as EnumObjects(void(CAnotherClass::*EnumObjectCallbac k)(OBJECT)) that would otherwise be an solution. But then I could liklewise write EnumObjects(CAnotherClass *pAnotherClass), and this would beat the purpose of the callback.

So the question is:
How do I use pointer to member function as callback functions?

Note that this is NOT a question about STL, since most experienced programmers out there will see that the EnumObjects function does exactly the same thing as std::for_each algo. You don't need to point that out! BTW the for_each algo even have the same callback problem! Also, it is not a question about linked lists and containers, unless your super linked list solves the problem!