What is the difference between std::exception and user-defined exceptions?
Show answer and explanation
std::exception is the polymorphic base of the standard exception hierarchy and exposes the virtual what() diagnostic. A user-defined exception represents domain-specific failure and should normally derive from an appropriate standard type such as std::runtime_error or std::logic_error, optionally carrying structured context. Catching by const std::exception& gives a generic boundary while earlier handlers can still match the domain type precisely.
std::exception is the polymorphic base of the standard exception hierarchy and exposes the virtual what() diagnostic. A user-defined exception represents domain-specific failure and should normally derive from an appropriate standard type such as std::runtime_error or std::logic_error, optionally carrying structured context. Catching by const std::exception& gives a generic boundary while earlier handlers can still match the domain type precisely.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.