exception handing (I)

    技术2024-07-01  66

    Exception handing in program can connect the unexpected events to higher exections context, it's able to recover from the abnormal events better.

     

    C++ could specify whether or a function could throw exceptions too.

    void MyFunc() throw(...) { throw 1; } throw could emit any type: string, int, class, .... class CTest{ }; void MyFunc() { CDtorDemo D; cout<< "In MyFunc(). Throwing CTest exception./n"; throw CTest(); }
    最新回复(0)