#include
#include
#include
#include
using namespace std;
class base
{
public:
typedef void (base::*func)();
};
class device:public base
{
public:
void f()
{
cout << "ffffff" << endl;
}
};
///我有点不明白,为什么这样可以调用到子类的函数,已经强转到基类了
void change(base::func f, void obj)
{
(((base)obj)->*f)();
}
int main()
{
device d;
change((base::func)(&device::f), &d);
return 0;
}