          virtual  , 
      . ,     
D        D    vf(),     
       virtual.    
  .      *,    
 cObject  *.    ,  
  vf()  ,    : 

    p->vf();	 

           ,   . ,  
        ,  
  .       ,    
vf(),   .       ,  
  vf(),   .       
     ,    . 

         

             
.           
  . 
    ,         
    ,  ,   .   
   (   ),      
Shape  : 

    class Shape { 
    public:	
        ..........  // ...   
        virtual void DrawO; 
    }: 
 
       ,     ,  ,  
     . ,  ,   
-    Shape, ,    
(,   ,      ): 

    Shape *picture[100];	//     Shape 

       ,  picture    100 
 Shape.       Shape*, ,  
        ,    
  Shape      .    
Shape    Draw(),    , 
 DrawO     picture: 

    int i = 0; 
    while (i < 100 && _picture[i] != 0)  { 
       //    Draw()             
       picture[i]->Draw(); 
       i++; 
    }

        ,    ,     
      !       
 ,   ,        
     .OBJ-.   (  ) 
     Shape,       
picture,   while     Draw()   
   . 
     ,           
 ,     picture,   
      Shape.     
,   Draw()  . ,   
  Circle ()  Line ()   Shape: 
    
    class Circle:   public Shape { 
    public: 
       virtual void Draw(); 
    }; 
    
    class Line: public Shape { 
    public: 
       virtual void Draw(); 
    }; 

          Draw   
Circle  Line    .    
     ,    
 . ,      picture  
 : 


    352  III.   ANSI C++
