Does the standard library of C++ contain an exception equivalent to .NET's NotImplementedException?
If not, what are the best practices to handle incomplete methods that I intend to complete later on?
The NotImplementedException exception indicates that the method or property that you are attempting to invoke has no implementation and therefore provides no functionality. As a result, you should not handle this error in a try/catch block. Instead, you should remove the member invocation from your code.
An exception in C++ is thrown by using the throw keyword from inside the try block. The throw keyword allows the programmer to define custom exceptions. Exception handlers in C++ are declared with the catch keyword, which is placed immediately after the try block.
std::logic_errorDefines a type of object to be thrown as exception. It reports errors that are a consequence of faulty logic within the program such as violating logical preconditions or class invariants and may be preventable.
In the spirit of @dustyrockpyle, I inherit from std::logic_error
but I use that class's string constructor, rather than overriding what()
class NotImplemented : public std::logic_error { public: NotImplemented() : std::logic_error("Function not yet implemented") { }; };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With