         -  -,  
   . 

    ,     
   ,        
 .      , 
 TBase     ,    
.   TBase,      , 


      class TDerived:   public TBase { 

          TBase     
TDerived.    TBase      
 ,   TDerived       TBase. 

    class TDerived:   private TBase { 

          TBase     
TDerived.   TDerived       
 TBase.          protected. 


    TDerived():   TBase()  {   }	

    TDerived()    
      TBase().     
    ;    ,    
     . 


   TDrived::TDerived()  //  
      :  TBase()    //     
    {
       //       
    }



    class  {         
    public:	
       int x;	' , 
       () { cout  "Inside A's constructor\n"; x = 0; } 
       void Display(void) { cout  "x == "  x  '\n'; }
    } ;
               
 ,        . 
,  ,          
 ,      Display()      ,  
    .       
  ,     ,       
 ,      : 
    class :   private  {	
    public:
      A::Display;               //   Display()
      (): 
      () { cout  "Inside B's constructor";   }                      
    }  
     A::Display;       , 
  ,    ,   .  
       ,   ,  
- Display()  .    Display()
        : 


       ,      
    . (,    
    -. .  15.) C++ 


    Display()  ,   .


       ,       
  ,    , 
  ,      . 


     -    15.      
 ; - resolution()   TTimer.	


             
  C++,   .   
C++             
   ,    (. 14.10  14.11). 


          virtual  , 
      . ,     
D        D    vf(),     
       virtual.    


   21:   	TValue *basep;
   22:
   23:	basep = new TValue(10);   
   24:	cout  basep->GetValue()   '\n';    //  10 
   25:	delete basep; 
   26:	 
   27:	basep = new TMult(10,  2);         .   // !!! 
   28:	cout  basep->GetValue()  '\n';    // !!!  20 
   29:	delete basep;

    TBase *pbase; 
    pbase = new TDerived("String 1",  "String 2"); 

- GetValue()    .  
    - GetValue()
   .     
-, C++       .   , 


,     virtual     
   . 


           ,   ,  
      = 0. ,   
   class AbstractClass    {  
   public: 
      virtual void f1(void);         //   - 
      virtual void f2(void) = 0;  //   - 
    } 


     ,  -  AbstractClass     
-.


       - 
        ,     
-,        
   .     ,  
       . 

     	
    myObject.f1 ();	
        f1(),   f2()  MyClass.	: 


    6, C++     ,   
: 
    class TElem;   //   	


    -  ,   ,   . 
    ,    ,     , 
     ,       .

    class D:  public A,  public  { 
    public: 
         void f(void); 
         .......
     };
     - f()  ,     
Display()  .    ,   
         
:
   void D::f( void )
   { 
       Display();      // ??? ;   
       ::Display() ;    //  -  
       ::Display() ;    //  -  
   }
    

    lass D:  public A,  public ,  public  { 
    public:
       D():  (),   (),   ()  {  }	//   
       ........
     };
          
    class D:   public A,   public ,   public  { 
    public: 
        D() ;	// ,    
        ......
    }; 
      , ,   : 
    D::D() 
       :  (),   (),   () 
    {	
        ... //    D() 
    }


             
,  ,    FRANCH.CPP.  
  ,   -    
     . 


      (  ) ,   , 
  ,      
  ,      
      -,   
.          
     ,       
 . 
      14.9 ,    Corporation, 
   ,     
  McDougles. 

     Company  ,      Jennys, McDougles, 
BurgerQuen, Bob, Ted  Alice, ,    
        
-. , Bob    : 

    class Bob 
    : virtual public Jennys,	
       virtual public McDougles { 

   virtual     
 ,     ,   Jennis  
McDougies,         . 
,   Ted  Alice ( 43-52)    . 
        Corporation ( 54-64).   , 
   McDougies, Ted  Alice. ,   
McDougies           
 Corporation,   ,  Ted  Alice     McDougies. 
