class
std::logic_error
<stdexcept>
Logic error exception
This class defines the type of objects thrown as exceptions to report errors in the internal logical of the program. These are theoretically preventable.
It is used as a base class for several logical error exceptions, and is defined as:
1 2 3 4
|
class logic_error : public exception {
public:
explicit logic_error (const string& what_arg);
};
|
Its sibling class
runtime_error is used as a base for exceptions reporting an error that can only be determined during runtime.
Members
- constructor
- The constructor takes a standard string object as parameter. This value is stored in the object, and its value is used to generate the C-string returned by its inherited member what.
The class inherits the
what member function from
exception, along with its
copy constructor and
assignment operator member functions.
See also
- exception
- Standard exception class (class)
- runtime_error
- Runtime error exception (class
)
- domain_error
- Domain error exception (class
)
- invalid_argument
- Invalid argument exception (class
)
- length_error
- Length error exception (class
)
- out_of_range
- Out-of-range exception (class
)