## 19.3.2 (cont.) Throwing Objects

Users often define their own exceptions:

>     class MyApplicationError
>     {
>     public:
>        MyApplicationError(const string& r);
>        string& what() const;
>     private:
>        string reason;
>     };

>     MyApplicationError::MyApplicationError(const string& r)
>        : reason(r) {}

>     string& what() const
>     {
>        return reason;
>     }

prev |top |next