は、私が実現したいものです。C++メンバ関数ポインタを別のクラスに渡すには?ここ
class Delegate
{
public:
void SetFunction(void(*fun)());
private:
void(*mEventFunction)();
}
次にテスト
テスト(で今class Test
{
public:
Test();
void OnEventStarted();
}
)という名前のクラスで、私はこのように委任するOnEventStarted渡したい:
Test::Test()
{
Delegate* testClass = new Delegate();
testClass->SetFunction(this::OnEventStarted);
}
しかしOnEventStartedは非静的メンバー関数ですが、どうすればよいですか?
[Do not。](https://isocpp.org/wiki/faq/pointers-to-members#memfnptr-vs-fnptr) – crashmstr