Created
May 25, 2015 04:29
-
-
Save MasazI/c9daa2069403c6ee327b to your computer and use it in GitHub Desktop.
stdexcept.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// stdexcept.cpp | |
// CplusplusPractice | |
// | |
// Created by masai on 2015/05/25. | |
// Copyright (c) 2015年 masai. All rights reserved. | |
// | |
#include <iostream> | |
#include <stdexcept> | |
using namespace std; | |
class processing{ | |
public: | |
void function(){ | |
throw std::logic_error("an logic error."); | |
} | |
}; | |
int main(int argc, char* argv[]){ | |
processing p; | |
try{ | |
p.function(); | |
}catch(const std::logic_error& e){ | |
cout << e.what() <<endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment