1999

Grusel++ of the month

Home
Download Source
/******************************************************************************/
/*                                                                            */
/*                                                         FILE: NOVEMBER.CPP */
/*                                                                            */
/*  Demonstrates how to use operator()                                        */
/*  ==================================                                        */
/*                                                                            */
/*  Compiled and tested with Visual C++ V6.0                                  */
/*                                                                            */
/*  V1.00   09-NOV-1999   P. Tellenbach   http://www.heimetli.ch/             */
/*  V1.01   19-NOV-1999   H. Hueni        http://www.glue.ch                  */
/*                                                                            */
/******************************************************************************/

#include <iostream.h>

class printf
{
 public:
   printf( char c )
   {
       cout << c ;
   }

   printf &operator()( char c ) 
   {
       cout << c ;
       return( *this ) ;
   }

   int operator()( char *s )
   {
       cout << s ;
       return( 0 ) ;
   }
} ;

/***********/
 int main( )
/***********/

{
  return printf( 'G' )( 'r' )( 'u' )( 's' )( 'e' )( 'l' )( "++" ) ;
}