#ifndef BASEH #define BASEH #include using namespace std; class base { int i; public: base(int initial_i): i(initial_i) {} virtual ~base() {} virtual void f() const {cout << "base::f " << this << "\n";} virtual void g() {cout << "base::g " << this << "\n";} virtual int h(int a, int b) const {return a + b;} }; typedef void (*pf_t)(const base *); typedef void (*pg_t)( base *); typedef int (*ph_t)(const base *, int, int); typedef pg_t px_t; //pointer to generic member function inline ostream& operator<<(ostream& os, pf_t p) { const size_t n = reinterpret_cast(p); return os << reinterpret_cast(n); } inline ostream& operator<<(ostream& os, pg_t p) { const size_t n = reinterpret_cast(p); return os << reinterpret_cast(n); } inline ostream& operator<<(ostream& os, ph_t p) { const size_t n = reinterpret_cast(p); return os << reinterpret_cast(n); } #endif