home *** CD-ROM | disk | FTP | other *** search
- // "Static Members" -- STATIC.HPP
- //
- // This program that illustrates the use of
- // static data and static member functions.
-
- #include <iostream.h>
-
- class myComplex
- {
- public:
- myComplex(); // default constructor
- myComplex( myComplex& C); // copy constructor
- ~myComplex(); // destructor
-
- static int getCount() // static member function
- { return m_nCount; } // that returns the number of
- // instances of myComplex class
-
- void setReal(double fReal) // other member functions
- { m_fReal = fReal; }
- void setImag(double fImag)
- { m_fImag = fImag; }
-
- void show();
-
- static int m_nCount; // the static data member
-
- protected:
- double m_fReal; // hidden member data
- double m_fImag; // (class use only)
- };
-
-
-