You probably do not want to dynamically change the function at runtime, If you do then one of the other answers will show you how to use functors. But to me it sounds like you want different objects to have different functionality based on some property of the object.
This is what virtual function are for:
You define the action in the base class. Then in a derived class you give the actual implementation based on how the object is meant to act.
class MyClass
{
public:
virtual void onShow() = 0;
};
class Window: public MyClass
{
public:
virtual void onShow() { /* Draw Window */ }
};
void aboutToShowObject(MyClass& obj)
{
obj.onShow();
}