new 運算子 (C++)

new 運算子 (C++)

瀏覽:1098
日期:2024-04-21
當使用 new 來配置 C++ 類別物件的記憶體時,會在配置記憶體之後呼叫物件的建構函式。 使用 ... // expre_new_Operator2.cpp // C2660 expected class A { public: A(int) { throw "Fail!"; } }; void F(void) { try { // heap memory pointed to by pa1 will be A* pa1 ......看更多