初歩的な質問ですが[//]部の4っのコードの動作の違いがわかりません
testB::f2;はtestBを指定してることはわかるのですがそれ以上の意味がわからないため質問しました。
class testB { public: //testB(const testA x) explicit testB() { //std::cout << x; } void f() { cout << "ptr\n"; } static void f2() { cout << "static\n"; } void (*fp)() = f2;// void (*fp2)() = &testB::f2;// void ffp() { } }; void ff() { cout << "a"; } int main() { testB b; b.fp();// (b.fp)();// b.fp = ff; b.fp(); b.fp = &testB::f2; char c = getchar(); return 0; }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。