Answer the question
In order to leave comments, you need to log in
What is the best way to write your own exception class for your library?
Interests from what that it is necessary to inherit.
For example, there is a string class.
We will throw an exception when we try to access a non-existent character of a string.
If we make our own exception class, then do we need to inherit the ExceptionOutOfRange class multiple from std::out_of_range and our own Exception?
Is it worth making such a class at all, and not throwing std::out_of_range?
And similar questions.
Answer the question
In order to leave comments, you need to log in
You need your own class, inherited from the standard one.
Causes?
Because when processing, sometimes different actions are needed: for errors in a specific library and for a general error.
You need several classes for different occasions.
Causes?
Library users will want to handle different errors differently.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question