給定以下類別定義: class A { private: static int cnt; class B { private: public: }; B* p[5]; public: A() {cnt=0;} int f() { if (cnt<5) p[cnt++]=new B; return cnt; } }; int A::cnt=-100; 若在 main()中執行以下指令: A var; var.f(); var.f(); cout << var.f(); 則將產生的輸出為何?
A1
B3正確答案
C5
D7
答案與詳解
