Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ throw exception

#include <stdexcept>

int compare( int a, int b ) {
    if ( a < 0 || b < 0 ) {
        throw std::invalid_argument( "received negative value" );
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #throw #exception
ADD COMMENT
Topic
Name
7+1 =