#ifndef MT3Q5_H #define MT3Q5_H /////////////////////////////////////////////////////////////// // MT3Q5.h - Function Pointer // // // // Jim Fawcett, CSE687 - Object Oriented Design, Spring 2012 // /////////////////////////////////////////////////////////////// #include #include class X { public: typedef void(X::*fptr)(const std::string&); void fun(const std::string& s) { std::cout << "\n X::fun displaying \"" << s.c_str() << "\"\n"; } }; void globFun(X& x, X::fptr fp, const std::string& s) { (x.*fp)(s); } #endif