Skip to content

Instantly share code, notes, and snippets.

@MasazI
Created May 25, 2015 04:29
Show Gist options
  • Save MasazI/c9daa2069403c6ee327b to your computer and use it in GitHub Desktop.
Save MasazI/c9daa2069403c6ee327b to your computer and use it in GitHub Desktop.
stdexcept.cpp
//
// 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