Computer PPSC
How do you define the user-defined exceptions?
Explanation
In C++, a user-defined exception is created by defining a class that inherits from the standard exception class (such as std::exception) and overriding its what() member function to return a custom error message. The exception object can then be thrown and caught like a built-in exception.
Related facts:
The what() function returns a description of the exception.
User-defined exceptions make error handling specific to an application's own error conditions.
Exam tip: Custom exception equals a new class inheriting the exception class plus an overridden what().