324                                                     11. 

      
 catch     .
,          
  .

11.10.     

    C++  
. ,  Borland     11 ,
  new       .
  ,   .

  except, 

^include <iostreain.h>

#include <except.h> //  xalloc  xmsg

int main()
{

int *p, n;

try {

while (true) {

cout  " ? "  endl;

 in  n;

p = new int[n] ;

}

catch(xalloc x){cout  " xalloc"  endl;}

catch (...){cout  "  \n"  endl;}

}

    ,     .   -
        
xalloc.    ANSI        bad_alloc.

       -
 .   bad_cast    exception. 
 ,  RTTI   :

  bad_cast.cpp

#include <iostream.h>
ttinclude <typeinfo.h>
^include <stdexception>
using namespace std;

class A {
public:

virtual void foo(){ cout  " "  endl;}

};