Monday, January 11, 2010

The underflow_error Class






Class Name underflow_error

Header File <stdexcept>

Classification Exception

Class Relationship Diagram



Class Description

Member Classes




None

Methods




underflow_error(const string &What_Arg)




Example





Class Description



The underflow_error class is derived from the runtime_error class.
The underflow_error class represents exceptions that occur because
arithmetic overflow error.






Method underflow_error()

Access Public

Classification Constructor

Syntax underflow_error(const string &What_Arg)

Parameters The What_Arg parameter should contain a description of the kind of exception
that has occurred.

Return None



Description



The underflow_error() method constructs an object of type underflow_error. The What_Arg parameter
can be used to set a description of the kind of error that this exception represents.
A set possible solutions is sometimes supplied with the exception description in addition
to the type of error.





The Class Relationship Diagram of underflow_error









1
2 #include <stdexcept>
3
4
5 void main(void)
6 {
7
8
9 try{
10
11 exception X;
12 throw(X);
13 }
14 catch(const exception &X)
15 {
16 cout << X.what() << endl;
17
18 }
19
20 try
21 {
22 underflow_error UnderFlow("Arithmetic Operation Underflow");
23 throw(UnderFlow);
24 }
25 catch(const exception &X)
26 {
27 cout << X.what() << endl;
28 }
29
30
31
32 }
33



No comments: