home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_11 / 8n11086b < prev    next >
Text File  |  1990-09-18  |  249b  |  18 lines

  1.  
  2.     class Inc {
  3.     public:
  4.         Inc( int n = 0)        { val = n; }
  5.         void increment()    { val++; }
  6.     private:
  7.         friend void print( Inc);
  8.         int val;
  9.     };
  10.  
  11.     void print( Inc i) { printf( "%d ", i.val); }
  12.     
  13.     ...
  14.     Inc i(3);
  15.     i.increment();
  16.     print( i);
  17.  
  18.