home *** CD-ROM | disk | FTP | other *** search
/ Microsoftware Monthly 19…2 Programming Power Tools / MASO9512.ISO / cpptutor / cpptutor.arj / EXAMPLES / EX0601.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-27  |  499 b   |  16 lines

  1. // \EXAMPLES\EX0601.CPP
  2. // The HELLO WORLD program using a constructor and destructor
  3.  
  4. #include <iostream.h>    //  for stream I/O
  5.  
  6. class world {            //  definition of the class world
  7. public:
  8.   world() { cout << "Hello World" << endl; };  // constructor
  9.   ~world() { cout << "Goodbye" << endl; };     // destructor
  10. };
  11.  
  12. world hello;                                   // global object
  13.  
  14. void main ()                                   // main
  15. { cout << "This is main." << endl; };
  16.