⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 domerror.htm

📁 这是关于VC++中的STL容器的资料,包括了STL容器各个类之间关系以及类的说明
💻 HTM
字号:
<html>
<head>
<title> The domain_error Class</title>
</head>

<body bgcolor="#FFFFFF">


<img src="leban3.gif">

<pre>
<font size=5>Class Name</font>            domain_error

<font size=5>Header File</font>           &lt;stdexcept&gt;

<font size=5>Classification</font>      Exception
</pre>
<a href="domerror.htm#diagram">Class Relationship Diagram</a><br>
<br>
<a href="domerror.htm#desc">Class Description</a><br>
<h1>Member Classes</h1>


<i>None</i>

<h1>Methods</h1>
<pre>

<a href="domerror.htm#domainerror">domain_error(const string &What_Arg)</a><br>

</pre>

<a href="domerror.htm#example"><h2>Example</h2></a><br>
<hr>
<a name="desc"><h3>Class Description</h3></a>
<p>
The domain_error class  is derived from the  logic_error class.  The domain_error class
represents exceptions  that are  occur because  some piece of the software component that
causes the exception is violating some domain specification.   Domain specifications are
implementation  specific and class specific. What constitues a domain error will depend 
on the context in which the error occurs and what types of  attributes, characteristics, 
and behaviors are acceptable in that context.  This  class of exception represents a '
wrong subject matter or wrong content'  violation as opposed to  a 'wrong object type ' 
violation. This class represents a node class and  can therefore be used as a base class 
for user defined classes. The current version of the C++ standard  does not require any method
in the standard C++ classes to throw  and exception  class domain_error.
</p>
<hr>
<pre>

<a name="domainerror">Method            domain_error()</a>

Access            Public

Classification    Constructor

Syntax            domain_error(const string &What_Arg)      

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

Return            None

</pre>

<h3>Description</h3>
<p>
The domain_error() method constructs an object of type domain_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.
</p>
<hr>
<a name="diagram"><h2>The Class Relationship Diagram of domain_error</h2></a>
<img src="domain.gif">
<hr>


<a name="example"></a>
<img src="lego.gif">
<pre>
    1   
    2   #include &lt;stdexcept&gt;
    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 &lt;&lt; X.what() &lt;&lt; endl;
   17   
   18      }
   19   
   20      try
   21      {      
   22          domain_error DomainError("Domain Mistake");
   23          throw(DomainError);
   24      }
   25      catch(const exception &X)
   26      {
   27          cout &lt;&lt; X.what() &lt;&lt; endl;
   28      }     
   29      
   30   
   31   
   32   }
   33   
</pre>
<hr>
</body>
</html>



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -