4.1. CException - Exceptions & Exception-handling.

Microsoft Visual C++/Microsoft Foundation Classes


4.1. CException - Exceptions and Exception-handling.

4.1.1. How do I throw a CUserException derived exception?

When I try to catch a derived exception I get the following error: error C2039: 'classCMyException' : is not a member of 'CMyException' 'classCMyException' : undeclared identifier 'IsKindOf' : cannot convert parameter 1 from 'int*' to 'const struct CRuntimeClass*'

You need to make your CMyException class dynamically creatable using the DECLARE_DYNAMIC() and IMPLEMENT_DYNAMIC() macros. The CATCH macro expects to be able to access run-time information about the thrown class.

- [email protected], Mike B, 6/5/95, comp.os.ms-windows.programmer.misc

4.1.2. Do my exceptions have to be derived from CUserException?

No: The "User" in CUserException simply means that the exception is caused by user actions. It is a common misperception that this is the only exception you can derive from.

[email protected] via email 11/23/95