 Pointer to member function within a class                         

// Wants to have a POINTER to a MEMBER FUNCTION to another class.
// Example code:
#include <iostream.h>

class A {
    public:
    void foo(void)
    {
        cout << "\n in A::foo";
    }
};

class B {
    public:
    void(A::*ptr)(void); //pointer to MEMBER FUNCTION of class A defined
};                       //in class B


main()
{
    B xx;
    A yy;

    void(A::*ptr2)(void);  //pointer to MEMBER FUNCTION of class A defined
    ptr2=A::foo;           //locally

    (yy.*ptr2)();          //This call is similar to

    xx.ptr=A::foo;
    (yy.*(xx.ptr))();      //this call
}

