The C++Course provides a general introduction to programming in C++. It is based on A.B. Downey's book, How to Think Like a Computer Scientist. Click here for details. |
Home Classes and invariants Private Functions | ||
Private Functions
{ private: double real, imag; double mag, theta; bool cartesian, polar; void calculateCartesian (); void calculatePolar (); public: Complex () { cartesian = false; polar = false; } Complex (double r, double i) { real = r; imag = i; cartesian = true; polar = false; } void printCartesian (); void printPolar (); double getReal (); double getImag (); double getMag (); double getTheta (); void setCartesian (double r, double i); void setPolar (double m, double t); }; The private label at the beginning is not necessary, but it is a useful reminder.
|
||
Home Classes and invariants Private Functions |