Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does C++ have an equivalent to .NET's NotImplementedException?

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?

like image 939
becko Avatar asked Jun 28 '14 18:06

becko


People also ask

What is throw new NotImplementedException() c#?

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.

How do you throw an error in C++?

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.

What is std :: Logic_error?

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.


1 Answers

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") { }; }; 
like image 73
MatrixManAtYrService Avatar answered Oct 04 '22 22:10

MatrixManAtYrService