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

  1. // "Using this pointers" -- THIS.HPP
  2. // This program illustrates the use of the 'this' pointer
  3.  
  4. #include <iostream.h>
  5.  
  6. class myComplex
  7. {
  8.   public:
  9.     myComplex(double fReal = 0,    // constructor
  10.               double fImag = 0);
  11.  
  12.     void setReal(double fReal)    
  13.       { m_fReal = fReal; }        
  14.     void setImag(double fImag)
  15.       { m_fImag = fImag; }
  16.  
  17.     void show();                     // display contents
  18.  
  19.     myComplex& operator =(myComplex& C);
  20.     myComplex& operator =(double fReal);
  21.  
  22.   protected:
  23.     double m_fReal;    // real part
  24.     double m_fImag;    // imaginary part
  25. };
  26.  
  27.  
  28.