これはおそらく初歩的なものです。引数のないタイプの関数へのポインタを取るcell
識別子を持つ1つのクラス(と呼ばれる)の関数( )(これは I )を持っています。別のクラスでは、 のオブジェクトがあり、メソッドを使用します。許可されません。上記のタイトルでエラーが発生します。これら 2 つの関数がクラス内に埋め込まれていない場合は、正常に動作します。woo_func_ptr
void
void (*void_ptr)(void)
typedef
cell
woo_func_ptr
typedef void (*void_ptr)(void);
double WOO{0};
struct cell {
void woo_func_ptr(void_ptr jo)
{
jo();
}
};
class woosah
{
public:
void woo_func()
{
WOO+=rand();
std::cout << WOO << std::endl;
};
void run()
{
// other stuff
temp_cell.woo_func_ptr(woo_func);
// yet more stuff
}
cell temp_cell;
};