I would like to know how to write unmanaged exceptions in Visual C++?
#include <string>
#include <exception>
using namespace std;
using namespace System;
class GraphException : public Exception
{
public:
GraphException() { }
// GraphException(string message) : Exception (message)
// { }
// GraphException(string message, Exception inner) : Exception (message, inner)
// { }
};
this does not work i get the following error,
Error 1 error C3625: ‘GraphException’: an unmanaged type cannot derive
from a managed type
‘System::Exception’ c:\breadthfirst\graph\graphexception.h 10 1 breadthFirst
Can someone please help me?
Derive from
std::exceptioninstead ofException.Better yet derive from one of the more specialized exceptions in
stdexcept.