     Show()      cl  2   
.   Show()   ,   
Show()         -, 
 . 
    ,    Show() ( 30-33)   
,   si  s2.   Show()  
 ,      - si  s2, 
   .  ""     
     . 

     - 

          .    
  -  .  -  
      ,     . 

     15.3.  FRIEfJDMF.CPP (  -) 

    1:	#include <iostream.h> 
    2: 
    3:	class One;  //	   
    4: 
    5:	class Two { 
    6:	private: 
    7:	  char *s2; //	   Two 
    8:	public: 
    9:	  Two() { s2 =	"one, two, three"; } 
    10:	  void Show(0ne &c1); 
    11:	}; 
    12: 
    13:	class One { 
    14:	   friend void Two: :Show(One &c1); 
    15:	private: 
    16:	   char *s1; //	   One   Two:: Show 
    17;	public: 
    18:	   One() { s1 =	"Testing "; } 
    19:	}; 
    20: 
    21:	main() 
    22:	{ 
    23:	One c1; 
    24:	Two c2; 
    25: 
    26:	c2.Show(c1); 
    27:	return 0; 
    28:	} 
    29: 
    30:	void Two: :Show(One &d) 
    31:	{ 
    32:	  cout  c1.s1  s2  '\n'; 
    33:	} 

        FRIENDFN ( 15.2),    FRIENDMF 
  , One  Two.   One   
 - ( 14)       
   (Two::),    
  Show(). 
              
   ,  ,    
 -,    ,  - 
.   One,    Two::Show(), 
  Two     . 
                
  ShowO ( 3033).      One &cl. 
  Show()    Two,    
     Two.  c1.s1      
  32   ,    Show()   
One,     s1. - ShowO   
 s2 ,      Two,   
 Show(). 
      Show()    Two,     this, 
   ,     -.   
     Two ( 24),   
 Show()    ( 26). 


    15.   C++     371 
