std::exception is the base class for all standard exceptions. It provides the virtual what() method that returns an error message. Catching std::exception catches any standard exception: catch (const exception& e) { cout << e.what(); } This is useful as a fallback catch-all.
Create custom exceptions by inheriting from exception or its subclasses. Override what() to provide meaningful error messages. The exception hierarchy lets you catch specific types for specific handling or broad types for general handling.
Design your catch blocks from specific to general.