.


:




:

































 

 

 

 





, (exception), . , , . , , () throw, . , .

catch . , , , throw, , catch. , .

try-, . try-, catch- , catch-.

try {/* try*/

}catch(type1 arg){/* catch*/}

//

try catch. catch, . catch. try, throw.

#include <iostream.h>// 52

int main() {

try {

// try

cout << " try\n";

throw 10; // 10

cout << " \n";

}

catch (int i) { //

cout << " : "<< i << "\n";

}

catch (char *s) { //

cout << " : "<<s << "\n";

}

return 0;

}

:

try

: 10

throw , catch. int double, . , .

catch() {/**/}

throw :

void fun() throw (except1, except2, except3, char*) { }

, , try. throw , , , , . catch, , .

, , unexpected(), , terminate(), terminate() abort() .





:


: 2015-10-01; !; : 341 |


:

:

, .
==> ...

1332 - | 1255 -


© 2015-2024 lektsii.org - -

: 0.012 .