2000

Grusel++ of the month

Home
Download Source
/******************************************************************************/
/*                                                                            */
/*                                                             FILE: JULY.CPP */
/*                                                                            */
/*  Yet Another Way To Print Hello World (YAWTPHW)                            */
/*  ==============================================                            */
/*                                                                            */
/*  Compiled and tested with Visual C++ V6.0                                  */
/*                                                                            */
/*  V1.00   30-JUL-2000   P. Tellenbach   http://www.heimetli.ch/             */
/*                                                                            */
/******************************************************************************/

#include <iostream>

using namespace std ;

class World {
  public:
    World *operator->() {
      cout << "World" ;
      return this ;
    }

  int world() { return 0 ; } ;  
} ;

class Space {
  public:
    World operator->() {
      cout << " " ;
      return World() ;
    }
} ;

class Hello {
  public:
    Space operator->() {
      cout << "Hello" ;
      return Space() ;
    }
} ;

int main() {
  return Hello()->world() ;
}