home *** CD-ROM | disk | FTP | other *** search
-
- // "Creating a destructor" -- DESTRUCT.HPP
- // C++ program that illustrates destructors
-
- #include <iostream.h> // has the cout function
- // used for outputting messages
-
- class myComplex // beginning of class declaration
- {
- public:
- myComplex(); // default constructor
- virtual ~myComplex(); // destructor
-
- void setReal(double fReal)
- { m_fReal = fReal; } // change the real part
- void setImag(double fImag)
- { m_fImag = fImag; } // change the imaginary part
-
- void show(); // display the contents
-
- protected:
- double m_fReal; // real part
- double m_fImag; // imaginary part
- }; // end of class declaration
-
-