Exception Handling Class Woes
Hi ,
I have just been investigating the use of classes to do exception handling, and am just running into a few problems, and not sure why!!
Here is what im attempting code wise .. does any one know why i get an abnormal program termination when running this code? (using WinXP / MSVC++)
Code:
#include <iostream>
using namespace std;
class Exception
{
public:
Exception() {}
Exception(char *file,int line)
{
cout << "Exception on line: " << line << endl;
cout << "Exception in file: " << file << endl;
}
~Exception() { cout << "Destructor called" << endl; }
};
int main()
{
int i = 0;
if(i == 0)
throw Exception(__FILE__,__LINE__);
return 0;
}