. 13. ________________________________________395

dynamic_cast<TJ/ri7> ( v )

         ,  v   -
    .     -
 ,   .    :

class Base {  } ;

class Derived : Base {  } ;

void fen(Base* ptr)
{

Derived* dptr = dynamic_cast<Derived*>(ptr) ;

^

       ptr   Derived*.
  ,   0   -
 bad_cast.      --
.  ,     ,   -
 .       (
)       ( ).

 type id ()          
   .      
type_info,        
type_info.h  typeinfo.h.  type_info  - name (),
  ,   .  ,  
    .     -
      .  
      type id 
  bad_cast  bad_typeid,     -
,      NULL-   .  
 .  10.9,     ,  . 304 (
 typeid.cpp).

. 13.6.  

  virtual   ,  
        -
      .    
   -.  ,   -
 ,    .      
,     .      -
 .  ,      
,   (  ).   -
     ,    
   .        
  ,     .  
-          
,     .       -