so I have a problem with this:
class Exception{
private : string message;
public :
Exception();
Exception(string str);
string what();
};
class Something{
public : Something(int m) throw(Exception);
....}
and in the cpp file:
Exception::Exception()
{
message="cant divide by 0";
}
Exception::Exception(string str)
{
message = str;
}
Exception:string what()
{
return message;
}
and then i tried to use it inside some constructor
Something::Something(int m) throw(Exception)
{
if (m==0)
{
throw Exception();
}
};
and in the main
...
catch(Exception obj){
cout<<obj.what();
}
and it shows "Exception" does not name a type and 'obj' wasnt declared and I wonder why.