- 773 名前:デフォルトの名無しさん mailto:sage [2008/02/16(土) 13:19:46 ]
- とりあえず俺がチェックに使ったコード。
どう表示される? #include <iostream> #include <memory> class Test { public: Test(int n) : n(n) { } ~Test() { std::cout << "~Test(" << n << ")" << std::endl; } static Test* New() { Test test1(1); std::auto_ptr<Test> test2(new Test(2)); throw 1; return NULL; } private: int n; }; int main() { try { Test* test = Test::New(); test = test; } catch(int n) { std::cout << "catch" << std::endl; } return 0; }
|

|