【初心者歓迎】C/C++室 Ver.48【環境依存OK】at TECH
【初心者歓迎】C/C++室 Ver.48【環境依存OK】 - 暇つぶし2ch773:デフォルトの名無しさん
08/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;
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch