1. Abnormal 1.1 abnormal throwing exception throws using the throw keyword, using the syntax: throw abnormal exception is an object, such as INT i = 1; throw i, etc. You can also customize an exception class, throw the anomalous class when necessary: class myexception {}; throw myException (); // This cannot be used here; you can also use throw new myexception (), return here Is a pointer, the parameters are different when catch. 1.2 TRY block TRY block is used to capture an exception, so it must enclose an exception statement that can be thrown. After TRY is a set of processing code, called Catch clause, such as: try {... throw string ("INTERNAL ERROR: .."); // Customized exception, exception is string type ...} catch (String ExceptionMSG) ) {// handling string type} catch (const statsexception & stats) {...} catch (...) {// Processes all exceptions, but it cannot access exception object} If you throw a pointer, such as: throw new String ("Hello"); then Catch's parameters should be: catch (string * msg) {cout << msg-> c_str () << Endl; delete msg;} If the 1.3 exception object Catch clause is in a capture statement The exception declaration can be a type declaration or an object statement that best preserved the error message or some environment information in an exception object when throwing an exception. The copy, once the exception is thrown, and the other is when it enters the Catch statement, so it will consume many resources. If you take the following structure Catch: throw string ("Hello"); Catch (String & MSG) {cout << msg.c_str () << Endl;} Only copy once, that is, the abnormal object is copied when the abnormality is thrown After entering the CATCH clause, it is only access to the copy reference, and no second copy. If you use the following structure, then a copy is not required: throw new string ("Hello"); catch (string * msg) {cout << msg-> c_str () << Endl; delete msg;} When an abnormality, the abnormal object is established in the heap, throws a copy of the pointer of the object. After entering the catch, the pointer is copied, ie the pointer to the abnormal object twice, but for an exception The object itself is not copied. If you use the following structure, only the pointer of the exception object is copied, and the exception object is not copied: throw new string ("hello"); catch (string * & msg) {cout << msg-> c_str () << ENDL Delete msg;} The above code omits the TRY block. If you don't completely process the specified exception in a catch, you should reap out, re-thrown the statement: throw; // Do not need to add an exception object in Throw, it will throw the original anomaly object; If you want to modify the information in the exception object again, the parameters in the catch should be a reference type, which is the same as the general function parameter.