Skip to content

Instantly share code, notes, and snippets.

@sinannar
Created January 18, 2012 16:54
Show Gist options
  • Save sinannar/1634013 to your computer and use it in GitHub Desktop.
Save sinannar/1634013 to your computer and use it in GitHub Desktop.
Exception 1
#include <iostream>
#include <string>
using namespace std;
class Exception
{
public:
Exception(string e)
{
situation=e;
}
string getProblem() const
{
return situation;
}
private:
string situation;
};
int main(void)
{
try{
if(true)
throw Exception("fırlattt");
cout<<(1/0);
}
catch(Exception e)
{
cout<<"catch block -"<<e.getProblem()<<endl;
}
cout<<"go then"<<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment