C++相談室 Part4
■ このスレッドは過去ログ倉庫に格納されています
0096デフォルトの名無しさん
NGNG#include <iostream>
typedef void (*func)(int obj);
void test(int obj) {cout << obj << endl;}
class Foo {public: func test;};
int main() {
Foo *foo = new Foo;
foo->test = test;
//(reinterpret_cast<func>(foo))(0);
(*(reinterpret_cast<func *>(foo)))(0);
return 0;
}
g++では通ったぞ
コメントアウトしてる方の行はだめだったけど
■ このスレッドは過去ログ倉庫に格納されています