        typeid      Type_info 
(,    ),   
   Bad_typeid.    
typeid    catch,   . 

     

         Borland,  
,   typeid      
  .  ,   - 
 .

      15.20    typeid.   
      DOS-  Easy Win-. 
(       ,   
  .) 

     15.20.  TYPEINFO.CPP (  typeid) 

    1:	#include <iostream.h> 
    2:	#include <string.h> 
    3:	#include <typeinfo. h> 
    4:		
    5:	class AnyClass { 
    6:	public: 
    7:	   AnyClass(int c) { count = c; } 
    8:	private: 
    9:	   int count; 
    10:	}; 
    11: 
    12:	#pragma warn -use 
    13: 
    14:	int main() 
    15:	{ 
    16:	   char c; 
    17:	   int i; 
    18:	   double d; 
    19:	   AnyClass a(1); 
    20:	   AnyClass *pa = new AnyClass(2); 
    21: 
    22:	   cout  "Name  "  typeid(c).name()  endl; 
    23:	   cout  "Name  "  typeid(i).nameO  endl; 
    24:	   cout  "Name    typeid(d).name()  endl; 
    25:	   cout  "  "  typeid(a).name()  endl; 
    26:	   cout  "Name  "  typeid (pa).name()  endl; 
    27:	   cout  "Name  "  typeid (* pa).name ()  endl; 
    28:	   cout  "Name  "  typeid(typeid( i ) ).nane() endl; 
    29: 
    30:	   cout  endl; //     
    31: 
    32:	//       , 
    33:	//     ++ 4. 
    34:	/* 
    35:	   if (typeid(c) != typeid(d)) 
    36:	      cout  typeid(c).name()  "	and " 
    37:	       typeid(d).name()  "are not equivalent."  endl; 
    38:	*/ 
    39: 
    40:	// ,   name()    
    41:	//    .    .    
    42: 
    43:	if (typeid(c) != typeid(d)) {
    44:           cout  typeid(c).nante()  " and cout  typeid(d).name()  " are not equivalent."  endl; 
    45:        }
    46:
    47:
    48:       //           
    49:      if ( typeid( a ) == typeid( *pa ) ) 
    50:         cout  "a and pa are objects of the same types"  endl; 
    51:
    52:     //     Bad_typeid 
    53     try { 
    54:       cout  endl; 
    55:       cout  "Using a dereferenced null pointer typeid"  endl; 
    56:       int *p; // Define a pointer 
    57:       p =0;  // Assign null to the pointer 
 

    420      III.   ANSI ++
