Please read up on why pointers to non-static members are not supported.
http://www.parashift.com/c++-faq-lite/pointers-to-members.html
If you are looking to build something similar to a closure where you can pass an object's member function around and modify state on that object anonymously through this function, you could either pass "this" into each function (which isn't always possible), or you can use functors.
A functor is a class that is comprised mainly of just an operator(). What you'd do (and I haven't tested this, EVER) is create a base class with pure virtual operator(). In your derived classes, you can create a pointer inside the derived class to point to the object whose state you wish to modify. You would also implement a virtual operator() in the derived classes.
Inside the class whose state you want to modify, you create an instance of this derived class (which must be a friend). You instantiate this derived object with the "this" pointer of the class you wish to modify.
So when you want to pass this functor around in your code, you would pass state_modified_class.derived_functor_class instead of a pointer to a member function of state_modified_class. Your function showvariableconstituents would take a parameter of base_functor_class instead of a function pointer.
As I said, this is all theory. I don't know if it will actually work. I'm not a C++ expert.
edit:
#include <QtCore/QCoreApplication>
#include <iostream>;
using namespace std;
class BaseFunctor
{
public:
virtual void operator()() = 0;
};
class StateMod
{
friend class DerivedFunctor;
public:
class DerivedFunctor : public BaseFunctor
{
public:
DerivedFunctor(StateMod * tempths)
{
ths = tempths;
}
virtual void operator()()
{
ths->temp++;
}
private:
StateMod * ths;
};
DerivedFunctor derived;
StateMod(int x = 0) : derived(this)
{
this->temp = x;
}
void printTemp()
{
cout << "temp: " << temp << endl;
}
private:
int temp;
};
class demonstration
{
public:
void doit(BaseFunctor & basefunct)
{
basefunct();
}
};
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
StateMod moddy;
demonstration demo;
moddy.printTemp();
demo.doit(moddy.derived);
moddy.printTemp();
return a.exec();
}