zoukankan      html  css  js  c++  java
  • POCO exception

    #include "Poco/Exception.h"
    
    #include <iostream>
    
    POCO_DECLARE_EXCEPTION( , MyException, Poco::Exception )
    POCO_DECLARE_EXCEPTION( , MyFatalException, Poco::Exception )
    
    
    POCO_IMPLEMENT_EXCEPTION( MyException, Poco::Exception, 
        "Something really bad happened..." )
    POCO_IMPLEMENT_EXCEPTION( MyFatalException, Poco::Exception, 
        "Something really really bad happened..." )
    
    void reallyBad () 
    {
        throw MyException();
    }
    
    void reallyReallyBad ()
    {
        throw MyFatalException();
    }
    
    int main( void )
    {
        try {
            reallyBad();
        } catch ( MyException& ex ) {
            std::cout << ex.displayText() << std::endl;
        } catch ( MyFatalException& ex ) {
            std::cout << ex.displayText() << std::endl;
        }
    
        try {
            reallyReallyBad();
        } catch ( MyException& ex ) {
            std::cout << ex.displayText() << std::endl;
        } catch ( MyFatalException& ex ) {
            std::cout << ex.displayText() << std::endl;
        }
        system( "pause" );
        return 0;
    }
  • 相关阅读:
    NOIP提高组2004 合并果子题解
    RMQ问题之ST算法
    7.18考试
    7.18
    7.17
    7.16
    7.15
    7.14
    7.13考试
    7.13
  • 原文地址:https://www.cnblogs.com/miner/p/3376514.html
Copyright © 2011-2022 走看看