need help with exceptions
I have defined a class called Exception as follows:
#include <iostream>
#include <string>
class Exception{
string s;
public:
Exception(string error): s(error){};
friend ostream& operator << (ostream& os, Exception& e){
return os << "Exception: " << e.s;
}
};
I want a method in another class to throw an Exception. The Class is called PolyLine and it defined in PolyLine.h. What do I have to put in my method in PolyLine.h in order for this to work?
to I have to state that the method throws and excemption? if so where do I do it and what is the syntax?
Thanks in advance