home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 10 / ioProg_10.iso / soft / optima / samples.z / Destruct.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-30  |  755 b   |  26 lines

  1.  
  2. // "Creating a destructor" -- DESTRUCT.HPP  
  3. // C++ program that illustrates destructors
  4.  
  5. #include <iostream.h>       // has the cout function
  6.                             // used for outputting messages
  7.  
  8. class myComplex             // beginning of class declaration
  9. {
  10.   public:
  11.     myComplex();            // default constructor
  12.     virtual ~myComplex();   // destructor
  13.  
  14.     void setReal(double fReal)
  15.       { m_fReal = fReal; }  // change the real part
  16.     void setImag(double fImag)
  17.       { m_fImag = fImag; }  // change the imaginary part
  18.  
  19.     void show();            // display the contents
  20.  
  21.   protected:
  22.     double m_fReal;         // real part
  23.     double m_fImag;         // imaginary part
  24. }; // end of class declaration
  25.  
  26.